How to randomize, return and remove numbers from a pool using PHPThis is a featured page

$random_numbers = range(1,100);
shuffle($random_numbers);
$numbers_chosen = array($random_numbers[0],$random_numbers[1],
$random_numbers[2],$random_numbers[3]);

print "before ";
print_r($random_numbers); // first four numbers chosen

$random_numbers = array_splice($random_numbers,4);

print "after ";
print_r($random_numbers); // first four numbers chosen

print "chosen ";
print_r($numbers_chosen); // first four num5 bers chosen
?>


internet-tricks
internet-tricks
Latest page update: made by internet-tricks , Sep 14 2008, 7:00 AM EDT (about this update About This Update internet-tricks Edited by internet-tricks

40 words added

view changes

- complete history)
Keyword tags: None
More Info: links to this page

Anonymous  (Get credit for your thread)


There are no threads for this page.  Be the first to start a new thread.