php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42100 strings & arrays
Submitted: 2007-07-25 10:51 UTC Modified: 2007-07-25 17:12 UTC
From: lunter at interia dot pl Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 6CVS-2007-07-25 (CVS) OS: WinXP
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:
11 - 3 = ?
Subscribe to this entry?

 
 [2007-07-25 10:51 UTC] lunter at interia dot pl
Description:
------------
Direct reference to arrays and strings, etc (like in JS, C#).

Reproduce code:
---------------
<?
 print( array('a','b','c')[0] );
 print( 'abc'[1] );
?>

Expected result:
----------------
printed: ab

Actual result:
--------------
Parse error: syntax error, unexpected '['

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-25 11:13 UTC] lunter at interia dot pl
For example:

<?
 function f(){
  return ( array('a','b','c') );
 }

 print( f()[0] );
?>
 [2007-07-25 16:50 UTC] johannes@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Since feature has been requested before, maybe someday somebody has a patch, I can't see this happen, soon.
 [2007-07-25 17:12 UTC] lunter at interia dot pl
[quote]Please do not submit the same bug more than once.[/quote]
Sorry, but it is not a bug. It is a 'Feature/Change Request'.

[quote]An existing bug report already describes this very problem.[/quote]
It is not a problem. It is a 'Feature/Change Request'.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 22:01:33 2024 UTC