note 10419 added to array_rand
| From: | pianocomposer at hotmail dot com | Date: | Tue, 02 Jan 2001 22:10:44 +0000 |
| Subject: | note 10419 added to array_rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9277@lists.php.net to get a copy of this message | ||
(formerly ssmith@personalcarehmo.com)
Some people are having difficulty getting the above example to work. It really does work! Try
calling function fake_rand_array() with the following code (I may eat crow later if this turns out
to be the wrong advice, but it worked on MY system!!):
$name = array
('Sam','Betty','Jack','Jane','Jill','John
Tesh');
$rand_name = fake_array_rand ($name);
print "Here are the six names (no repeats) randomly ordered:<br>\n";
// just go thru all six of them randomly
for($i=0;$i<6;$i++){
print $name[$rand_name[$i]];
print "<br>\n";
}
http://www.php.net/manual/function.array-rand.php