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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 22 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC