|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50647 Short array notation
Submitted: 2010-01-04 11:46 UTC Modified: 2010-01-04 16:11 UTC
From: robert_xp at gmx dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.3.1 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-01-04 11:46 UTC] robert_xp at gmx dot net
A nice improvement for PHP would be a short hand notation for arrays. You can find more details here:

Reproduce code:
$arr = array(1, 2, array(5 => "foo", 3.14159), 9);

$arr = [1, 2, [5 => "foo", 3.14159], 9];

Expected result:
In both cases the result of $arr should be the same.

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 12:27 UTC]
This has already gone through the RFC process and been declined, per
 [2010-01-04 15:32 UTC] robert_xp at gmx dot net
Grml...Sorry, I didn't saw this before. I read the mailing lists, but I couldn't find a justification why this feature is declined. Most userspace votes were positive, and I added this feature independent from these discussions - maybe open another vote with more parts?
 [2010-01-04 16:11 UTC]
If you really, really, really want to reopen that can of worms, take it to the Internals mailing list. At best, you'll get a few suggestions to write a fresh RFC for possible inclusion in PHP 6. More likely, you'll get pointed to the same link I've pointed you to.

If you do this, bear in mind that it's been discussed many times over the years, and has been rejected each and every time. To whit, a possibly complete list of previous mailing list discussions back to the start of 2006:

December 2008:

May 2008:

January 2008: and

February 2007:

January 2006:

The (extremely lengthy) May 2008 discussion was the one that led to the RFC.

In short, this is pretty much in the same boat as being able to directly dereference array returned from functions, or ifsetor, or taint support, or some of the other regularly requested features that don't spring to mind at 12:07 on a Tuesday morning: it comes up on a regular basis, and while you and I may or may not agree with the decisions that have been made, they've been made, and I don't know that anyone will thank you for reopening a debate that's been had many times over.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 16:01:33 2024 UTC