note 113845 added to function.list
| From: | john at jbwalker dot com | Date: | Sun, 08 Dec 2013 00:31:11 +0000 |
| Subject: | note 113845 added to function.list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197835@lists.php.net to get a copy of this message | ||
The list construct seems to look for a sequential list of indexes rather taking elements in
sequence. What that obscure statement means is that if you unset an element, list will not simply
jump to the next element and assign that to the variable but will treat the missing element as a
null or empty variable:
$test = array("a","b","c","d");
unset($test[1]);
list($a,$b,$c)=$test;
print "\$a='$a' \$b='$b' \$c='$c'<BR>";
results in:
$a='a' $b='' $c='c'
not:
$a='a' $b='c' $c='d'
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.list.php
Edit -- https://master.php.net/note/edit/113845
Del: integrated -- https://master.php.net/note/delete/113845/integrated
Del: useless -- https://master.php.net/note/delete/113845/useless
Del: bad code -- https://master.php.net/note/delete/113845/bad+code
Del: spam -- https://master.php.net/note/delete/113845/spam
Del: non-english -- https://master.php.net/note/delete/113845/non-english
Del: in docs -- https://master.php.net/note/delete/113845/in+docs
Del: other reasons-- https://master.php.net/note/delete/113845
Reject -- https://master.php.net/note/reject/113845
Search -- https://master.php.net/manage/user-notes.php