shage Posted July 13, 2010 Share Posted July 13, 2010 Is there a way to make this check for dupes before posting out?? function RandomLine($file, $amount) { for ( $counter = 1; $counter <= $amount; $counter += 1) { srand ((double)microtime()*1000000); $f_contents = file("".$file.""); $line = $f_contents[array_rand($f_contents)]; if ($counter==$amount) print $line; else print $line.', '; } } $here = rand(4,10); thank you Link to comment https://forums.phpfreaks.com/topic/207562-no-dupes/ Share on other sites More sharing options...
ignace Posted July 13, 2010 Share Posted July 13, 2010 Nope, don't print them store them in an array. At the end of your function do a check for duplicates. Link to comment https://forums.phpfreaks.com/topic/207562-no-dupes/#findComment-1085240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.