ID: 19930 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Windows 2000 PHP Version: 4.2.3 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php list() requires numeric index. That's why pg|mysql_fetch_array(),etc returns both numeric and string indexed element. Previous Comments: ------------------------------------------------------------------------ [2002-10-16 05:02:42] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19930&edit=1