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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/207562-no-dupes/#findComment-1085240 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.