Re: array(...)[]

From: Date: Sun, 17 Oct 2004 16:33:36 +0000
Subject: Re: array(...)[]
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-13365@lists.php.net to get a copy of this message
Klaus Reimer wrote:
I've just seen that finally it's possible to do "$object->getOtherObject()->doSomething()" with PHP5 which was not possible in PHP4. But I wonder why something like this still does not work: $object->returnArray()[$index] returnArray()[$index] array(1,2,3,4)[$index] It would be really cool if a future version of PHP understands the above syntax because currently it's really annoying to access an array element returned from a method/function because the return value must be stored in a temporary variable before it is possible to access elements from that array.
I'm seconding this strongly. One of the most useful enhancements for meare, as you mention, $object->getOtherObject()->doSomething(), and the foreach ($a as $b => &c) syntax. Direct array referencing would be #3 for me [besides all the suport oo features] ;) - Markus

« previous php.internals (#13365) next »