ID: 41993
Updated by: [EMAIL PROTECTED]
Reported By: jcampbell1 at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: All
PHP Version: 5.2.3
New Comment:
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.
This has been requested multiple times before, till now nobody came up
with a working solution.
Previous Comments:
------------------------------------------------------------------------
[2007-07-13 23:09:32] jcampbell1 at gmail dot com
Description:
------------
It seems very strange that the [] operator cannot be used on the result
of a function.
Reproduce code:
---------------
function test() {
return array('dog','cat');
}
echo test()[0]; // produces a syntax error.
of course this works fine
class temp{}
function test() {
$o = new $temp;
$temp->foo = 'dog';
}
echo test()->foo; // works
Expected result:
----------------
dog
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41993&edit=1