note 36587 added to function.array-rand
| From: | wazaawazaa600 at msn dot com | Date: | Wed, 15 Oct 2003 16:24:41 +0000 |
| Subject: | note 36587 added to function.array-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58638@lists.php.net to get a copy of this message | ||
The function go well ever that you work with a simple array. An array of arrays (also called a
table), not works with the function correctly. Example:
$a=array(array(0,1),array(1,2),array(2,3),array(3,4),array(4,5));
echo $a[0][0];echo"<br>";
echo $a[1][0];echo"<br>";
$b=array_rand($a,2);
echo $b[0][0];echo"<br>"; //This writes nothing
echo $b[1][0];echo"<br>"; //This writes nothing
If you are in this situation, you will need to make your own solution.
----
Manual Page -- http://www.php.net/manual/en/function.array-rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36587
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36587&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36587&report=yes
Search -- http://master.php.net/manage/user-notes.php