php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43577 operator []
Submitted: 2007-12-12 09:04 UTC Modified: 2007-12-12 09:31 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lunter at interia dot pl Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 6CVS-2007-12-12 (CVS) 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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
14 + 4 = ?
Subscribe to this entry?

 
 [2007-12-12 09:04 UTC] lunter at interia dot pl
Description:
------------
I would be nice if PHP 6.x can use operator [] with called function.


Reproduce code:
---------------
<?
 function f(){
  return(array('a','b'));
 }

 print(f()[0]);
?>


Expected result:
----------------
Like now:

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

 $f=f();
 print($f[0]);
 unset($f);
?>

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-12 09:31 UTC] derick@php.net
We discussed this already as well a few times, also not going to happen.
 [2011-01-02 10:49 UTC] semtlenori at gmail dot com
to derick@php.net

Can you tell me where I can read the discussion? I am very interested in this 
issue, but can't find any discussions.

Thanks in advance.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 14:01:31 2024 UTC