Re: random array sort -- array() selection quant??
| From: | ROBERT MCPEAK | Date: | Tue, 10 Sep 2002 15:53:11 +0000 |
| Subject: | Re: random array sort -- array() selection quant?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115859@lists.php.net to get a copy of this message | ||
Thanks all for you submissions. This is what I came up with, where
$this_key is a random selection from the array $the_exploded_ids. I
don't know why, but, array_rand() won't work with selection quanity
parameter of less than 2. Anybody know why?
srand ((float) microtime() * 10000000);
$input = $the_exploded_ids;
$rand_keys = array_rand ($the_exploded_ids, 2);
$this_key=$input[$rand_keys[0]];
$this_key=trim($this_key);
>>> "ROBERT MCPEAK" <RMCPEAK@jhuccp.org> 09/10/02 10:22AM >>>
Could someone show me a quick and simple way to randomly sort array
elements? I can't seem to pinpoint the correct parameters in the
docs.
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php