- Code: Select all
<?
$quoteFile = "quotes.txt"; //File with quotes, a new quote should a new line in this document
$fp = fopen($quoteFile, "r");
$content = fread($fp, filesize($quoteFile));
$quotes = explode("\n",$content);
fclose($fp);
srand((double)microtime()*1000000);
$index = (rand(1, sizeof($quotes)) - 1);
echo $quotes[$index];
?>
Any comments or questions please post. Thanks,



