|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51281 Json-like alternative syntax for arrays
Submitted: 2010-03-12 09:18 UTC Modified: 2010-03-15 03:33 UTC
From: olamedia at gmail dot com Assigned:
Status: Wont fix Package: Arrays related
PHP Version: 5.3.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: olamedia at gmail dot com
New email:
PHP Version: OS:


 [2010-03-12 09:18 UTC] olamedia at gmail dot com
Json-like alternative syntax for arrays feature request.
It's much shorter, and don't have conflicts with current tokens.

Test script:
$a = [1,2];
$a = ['a':1,'b':2];
$a = array('a':1,'b':2);
$a = array('a'=>1,'b'=>2);
$a = ['a'=>1,'b'=>2];


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-12 09:31 UTC] olamedia at gmail dot com
Changing package
 [2010-03-12 12:34 UTC] olamedia at gmail dot com
Found in wiki a declined patch:
But I really want
$a = [[],[],[],[],[]]
instead of
$a = array(array(),array(),array(),array(),array());
 [2010-03-15 03:33 UTC]
-Status: Open +Status: Wont fix
 [2010-03-15 03:33 UTC]
Since you've already found the declined RFC that covered this, I'll simply quote 
what I wrote in bug #50647:

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 you've already found.

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 2007:

December 2008:

May 2008:

January 2008: and

February 2007:

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: Sun Jul 14 10:01:31 2024 UTC