note 36587 deleted from function.array-rand by nikic
| From: | nikic@php.net | Date: | Thu, 18 Oct 2012 14:30:00 +0000 |
| Subject: | note 36587 deleted from function.array-rand by nikic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191424@lists.php.net to get a copy of this message | ||
Note Submitter: wazaawazaa600 at msn dot com
----
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:
<?php
$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.