Re: random array sort
| From: | Jacob Miller | Date: | Tue, 10 Sep 2002 14:52:24 +0000 |
| Subject: | Re: random array sort | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115856@lists.php.net to get a copy of this message | ||
This appears to work
// Normal array
$a1 = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
srand((float) microtime() * 10000000);
$a_temp = array_rand($a1, sizeof($a1));
// Random array
while (list(, $value) = each($a_temp)) {
$a2[] = $a1[$value];} print_r($a2); - jacob At 22:22 09/10/2002, you wrote:
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