Io userei file() per ottenere il contenuto del tuo file e poi array_rand() .