Edit report at https://bugs.php.net/bug.php?id=12257&edit=1
ID: 12257
Updated by: nikic@php.net
Reported by: daniel_sevcik at hotmail dot com
Summary: list() can't handle associative arrays
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: *
PHP Version: *
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Support for associative array destructuring using list() has been added in PHP 7.1, see also: https://wiki.php.net/rfc/list_keys
Previous Comments:
------------------------------------------------------------------------
[2002-03-27 21:24:41] philip@php.net
This is now documented as a <note>.
A good feature request is to have list work on associative arrays, which would also mean it
won't rely on perfect 0,1,2... order either.
Imho this is a .5 bug and .5 feature request. Could someone explain why the current behavoir
exists? See also the user notes under list().
------------------------------------------------------------------------
[2001-08-31 10:23:35] sander@php.net
List() can't handle associative arrays. Moved to feature request.
------------------------------------------------------------------------
[2001-07-19 11:40:26] daniel_sevcik at hotmail dot com
<?php
$tmp=array(0=>1, "test"=>2);
list($xx,$yy)=$tmp;
echo("$xx, $yy");
?>
---Output:start---
1,
---Output:end-----
Variable $yy is empty (only if key name is not integer).
$tmp=array(0=>1, 1=>2);
In this case - it works...
Danny
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=12257&edit=1