note 20106 added to function.list
| From: | php at the dot chek dot com | Date: | Fri, 22 Mar 2002 12:05:02 +0000 |
| Subject: | note 20106 added to function.list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28075@lists.php.net to get a copy of this message | ||
It may seem obvious to some, but specifying more variables to assign to than array elements will
result in the excess variables being ignored, i.e. being of NULL type.
For example:
$x = array ("ein", "zwei", 'drei', 'vier');
list ($a, $b, $c) = $x;
echo gettype ($a) . ', ';
echo gettype ($b) . ', ';
echo gettype ($c) . ', ';
echo gettype ($d);
Would output "string, string, string, NULL"
This doesn't appear to produce any errors, though it may produce a low-level warning which
I'm not seeing.
--
http://www.php.net/manual/en/function.list.php
http://master.php.net/manage/user-notes.php?action=edit+20106
http://master.php.net/manage/user-notes.php?action=delete+20106
http://master.php.net/manage/user-notes.php?action=reject+20106