php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60405 Array dereferencing support do not work
Submitted: 2011-11-29 10:03 UTC Modified: 2011-11-29 11:34 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: bugzilla33 at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
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 10:03 UTC] bugzilla33 at gmail dot com
Description:
------------
Array dereferencing support do not work.

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

 print(array('pass')[0]);

 print(['pass'][0]);

?>

Expected result:
----------------
passpass

Actual result:
--------------
Parse error: syntax error, unexpected '[' in C:\htdocs\test.pl\1.php on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-29 10:30 UTC] bugzilla33 at gmail dot com
Package: Compile failure -> Scripting Engine problem
 [2011-11-29 10:30 UTC] bugzilla33 at gmail dot com
-Package: Compile Failure +Package: Scripting Engine problem
 [2011-11-29 11:00 UTC] bugzilla33 at gmail dot com
<?php

 $i=0;

 print(array('pass')[$i]);

 print(['pass'][$i]);

?>
 [2011-11-29 11:34 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It's not supposed to work in the 'array()' language constructor. (i.e. it isn't a function)
 [2011-11-29 11:34 UTC] felipe@php.net
-Status: Open +Status: Bogus
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 11:01:33 2025 UTC