note 35386 deleted from function.list by vincent
| From: | vincent@php.net | Date: | Fri, 29 Aug 2003 10:58:45 +0000 |
| Subject: | note 35386 deleted from function.list by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55290@lists.php.net to get a copy of this message | ||
Note Submitter:
----
It seems that list() works "backwards". Take this example:
$foo = array();
list($foo['a'], $foo['b'], $foo['c']) = array('a',
'b', 'c');
You would expect that $foo now has three values, "a", "b" and "c", and
in that order, but in reality the order of the values in $foo is "c", "b" and
finally "a".
Because of this, this code:
foreach ($foo as $key => $val) {
echo $key;
}
Will output "cba" and not "abc", as you might have expected.