note 39041 deleted from function.array-rand by didou

From: Date: Thu, 15 Jan 2004 11:28:08 +0000
Subject: note 39041 deleted from function.array-rand by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-63597@lists.php.net to get a copy of this message
Note Submitter: adanauktionATdanauktion.dk (Jesper) ---- Randomize 2 (or Multi) dimentional arrays. This does not work - the returned array is empty, but here is a soltion: //$org_list is a multi-dim array //$no_rand is elemets to extract $rand_list = array_rand($org_list,$no_rand); while(list($k, $f) = each($rand_list)) { //$f returns the random INDEX no ! $v=$org_list[$f]; //$v contains the randomízed element .. ..... .....

« previous php.notes (#63597) next »