View Single Post
Old 06-08-2005, 07:41 PM  
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
Oops. Fast and wrong ;)
I forgot that it returned the keys and not the values. This one works:

Code:
<?
$howmany = 3;
$quoteFile = "in.log";
$quotesArr = file($quoteFile);
$keys = array_rand($quotesArr, $howmany);
foreach ($keys as $key)
	print $quotesArr[$key]."<br>";
?>
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote