|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12257 list() can't handle associative arrays
Submitted: 2001-07-19 11:40 UTC Modified: 2016-03-27 21:04 UTC
Avg. Score:4.3 ± 0.9
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: daniel_sevcik at hotmail dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2001-07-19 11:40 UTC] daniel_sevcik at hotmail dot com
	$tmp=array(0=>1, "test"=>2);
	echo("$xx, $yy");


Variable $yy is empty (only if key name is not integer).
$tmp=array(0=>1, 1=>2);
In this case - it works...



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-31 10:23 UTC]
List() can't handle associative arrays. Moved to feature request.
 [2002-03-27 21:24 UTC]
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().
 [2010-12-14 12:05 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem -Operating System: W2000, Debian +Operating System: * -PHP Version: 4.0.6 +PHP Version: *
 [2016-03-27 21:04 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2016-03-27 21:04 UTC]
Support for associative array destructuring using list() has been added in PHP 7.1, see also:
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 08 19:03:42 2022 UTC