How can I use fread (or something similar) to grab a random word from a txt file? The txt file is a list of words separated by commas. e.g. "apple,banana,fish,bones,orange,grapefruit" etc... If it makes things easier, I can change the comma delimiter in the text file to something else.
$words = expode(',', file_get_contents('your-text-file.txt')); $word = trim($words[array_rand($words)]); echo $word; PHP: Untested.