php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60409 Array element access on instantiation
Submitted: 2011-11-29 13:13 UTC Modified: 2011-11-29 13:23 UTC
From: bugzilla33 at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.4.0RC2 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugzilla33 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-11-29 13:13 UTC] bugzilla33 at gmail dot com
Description:
------------
Please add array element access on instantiation

...like JavaScript, C# and all languages excluding PHP 5.4RC

Test script:
---------------
<?php

 $i=0;
 print(array('pa','th')[$i++]); // pa
 print(['wa','ss'][$i++]); // ss

?>

Expected result:
----------------
Parse error: syntax error, unexpected '[' in C:\htdocs\array.php on line 4

Actual result:
--------------
pass

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-29 13:21 UTC] felipe@php.net
-Status: Open +Status: Spam
 [2011-11-29 13:21 UTC] felipe@php.net
Please, stop posting same thing everytime. We already have your feature request at #60408.

Thanks.
 [2011-11-29 13:22 UTC] felipe@php.net
-Summary: Array element access on instantiation +Summary: Hidden because of SPAM -Status: Spam +Status: Open
 [2011-11-29 13:22 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-11-29 13:22 UTC] felipe@php.net
,
 [2011-11-29 13:23 UTC] felipe@php.net
-Summary: Hidden because of SPAM +Summary: Array element access on instantiation
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 17:01:33 2025 UTC