note 86694 deleted from function.shuffle by danbrown

From: Date: Thu, 30 Oct 2008 14:22:40 +0000
Subject: note 86694 deleted from function.shuffle by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145968@lists.php.net to get a copy of this message
Note Submitter: sweetsinsemilla at gmail dot com ---- RANDOM ASSOCIATIVE ARRAY $nice = array( 'a'=>'hi', 'b'=>'there', 'c'=>'big', 'd'=>'guy'); $random = array_merge(array_flip(array_rand($nice,count($nice))),$nice); I hate creating unnecessary functions. THIS WILL NOT WORK WITH ANY "INTEGER" KEYS PRESENT _WHATSOEVER_. Look into "array_merge" to see why. Works perfect on any single-dimensional array with nothing but STRINGS for keys. Might be a way to get integer keys to work, I didn't need it, post if you figure it out.

« previous php.notes (#145968) next »