note 100760 rejected from function.shuffle by danbrown

From: Date: Fri, 05 Nov 2010 03:27:19 +0000
Subject: note 100760 rejected from function.shuffle by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173769@lists.php.net to get a copy of this message
Note Submitter: ksalman at mac dot com ---- That function actually does not work, we modded it at StackOverflow to this: function shuffle_assoc($list) { if (!is_array($list)) return $list; $keys = array_keys($list); shuffle($keys); $random = array(); foreach ($keys as $key) { $random[] = $list[$key]; } return $random; } Which does work :)

« previous php.notes (#173769) next »