1) Can someone tell me the code to read a random line of text from a text file.
and
2) Add the randomly selected line into an dynamically generated image.
Many thanks --chris
1)
<?php $file = "/path/to/file"; if(file_exists($file)) { $contents = file($file); $line = mt_rand(0,(count($contents)-1)); echo "Line #".$line.": ".$contents[$line]; } else { echo "File does not exist"; } ?>