$text = file_get_contents('ruta_al_archivo.txt');$palabras = explode(' ', $text);$rand = mt_rand(0, count($palabras)-1);echo $palabras[$rand];