note 39041 added to function.array-rand

From: Date: Thu, 15 Jan 2004 11:05:08 +0000
Subject: note 39041 added to function.array-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-63595@lists.php.net to get a copy of this message
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 .. ..... ..... ---- Manual Page -- http://www.php.net/manual/en/function.array-rand.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39041 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39041&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39041&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63595) next »