note 15601 deleted from function.list by jimw
| From: | jimw@php.net | Date: | Fri, 19 Oct 2001 18:08:30 +0000 |
| Subject: | note 15601 deleted from function.list by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19171@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).