There are some cases where this could start becoming quite challenging and we might get into reference counting/separation problems, i.e.:
function foo() { return array(1,2,3); } foo()[1] = 4; or function foo() { $arr = array(); $arr[1] =& $var; } foo()[1] = 2; Anyway, these are the kind of things what we'd need to consider and with a few more minutes I can start thinking of some rougher ones where we'd need to return by reference and gracefully handle when you don't return by reference... I'm not opposed to this kind of syntax but it needs quite a lot of thorough thinking and it's a great example of where test-driven development would really be suitable (have like 20 of these weird cases in tests and try and understand if we can get this 100% right). Andi > -----Original Message----- > From: Stanislav Malyshev [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 09, 2006 5:44 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] Feature request > > >>> <?php > >>> function foo() > >>> { > >>> return array(1,2,3,4,5,6); > >>> } > >>> > >>> echo foo()[4]; // <---- it that > > It looks a bit perl-ish indeed but I don't see much trouble > in having that it people really need it... > > -- > Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] > http://www.zend.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List To > unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php