note 86694 added to function.shuffle

From: Date: Thu, 30 Oct 2008 03:44:15 +0000
Subject: note 86694 added to function.shuffle
Groups: php.notes 
Request: Send a blank email to php-notes+get-145961@lists.php.net to get a copy of this message
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. ---- Server IP: 64.71.164.2 Probable Submitter: 66.173.76.218 ---- Manual Page -- http://www.php.net/manual/en/function.shuffle.php Edit -- https://master.php.net/note/edit/86694 Del: integrated -- https://master.php.net/note/delete/86694/integrated Del: useless -- https://master.php.net/note/delete/86694/useless Del: bad code -- https://master.php.net/note/delete/86694/bad+code Del: spam -- https://master.php.net/note/delete/86694/spam Del: non-english -- https://master.php.net/note/delete/86694/non-english Del: in docs -- https://master.php.net/note/delete/86694/in+docs Del: other reasons-- https://master.php.net/note/delete/86694 Reject -- https://master.php.net/note/reject/86694 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145961) next »