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
 [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

Pull Requests

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: Mon Nov 25 09:01:30 2024 UTC