note 57068 deleted from function.shuffle by cmb

From: Date: Mon, 22 Nov 2021 17:24:38 +0000
Subject: note 57068 deleted from function.shuffle by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217284@lists.php.net to get a copy of this message
Note Submitter: bill at SWScripts dot com ---- Just a quick note to let people know that shuffle() will work on multidimensional associative arrays provided that the first key is already numeric. So this array can be shuffled without losing any of the secondary keys or their values: $array[0]['color'], $array[0]['size'], $array[0]['fabric'] . . . $array[50]['color'], $array[50]['size'], $array[50]['fabric'] I recently ran up against needing to randomize this array and tried shuffle even though it's not really for associative arrays. Hope it helps somebody out there.

« previous php.notes (#217284) next »