note 15601 added to function.list
| From: | martijn dot kriek at wanadoo dot nl | Date: | Sat, 22 Sep 2001 10:44:28 +0000 |
| Subject: | note 15601 added to function.list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18162@lists.php.net to get a copy of this message | ||
Note that if the number of variables passed to list() exceeds the number of array items, you will
get 'Undefined offset' warnings for these items:
$array = array(1,2); // Two elements
list($one, $two, $three, $four) = $array; // Four variables
Results in the following warnings:
Undefined offset: 3
Undefined offset: 2
Because the array only has elements 0 and 1, not 2 and 3.
Also note the order in which the warnings appear: this indeed indicates a 'reverse order'
in which the variables are set:
first $four (warning about undefined $array[3]),
then $three (warning about undefined $array[2]),
then $two and $one (assigned).
http://www.php.net:8070/manual/en/function.list.php