|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-16 06:23 UTC] yohgaki@php.net
[2002-10-21 03:24 UTC] flying at dom dot natm dot ru
[2002-10-21 17:15 UTC] iliaa@php.net
[2002-10-24 21:27 UTC] philip@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 05:00:01 2025 UTC |
list() function can only operate with indexed arrays, but it must also work with associative arrays, otherwise it can cause confusions. Take a look at the following example: <?php $array1 = array('aaa','bbb','ccc'); $array2 = array('a'=>'aaa','b'=>'bbb','c'=>'ccc'); list($a,$b,$c) = $array1; echo "$a\n$b\n$c\n"; list($a,$b,$c) = $array2; echo "$a\n$b\n$c\n"; ?> First list() invocation works well but second one throws notices about undefined array indexes and don't work at all. As a workaround it is possible to use: list() = array_values($array); but it is not a way to go.