note 118920 deleted from function.shuffle by tularis
| From: | tularis@php.net | Date: | Mon, 29 Feb 2016 10:22:59 +0000 |
| Subject: | note 118920 deleted from function.shuffle by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205066@lists.php.net to get a copy of this message | ||
Note Submitter: seindi at outlook dot com
----
function array_shuffle ($array) {
$tmp = array ();
$shuffle = array ();
$s = range (0, count ($array) - 1);
shuffle ($s);
foreach ($array as $key => $value) $tmp [] = array ("key" => $key,
"value" => $value);
foreach ($s as $s) $shuffle [$tmp [$s]["key"]] = $tmp [$s]["value"];
return $shuffle;
}
print_r (array_shuffle (array ("a", "b", "c")));