Re: Array access on function returns

From: Date: Fri, 18 Apr 2008 18:26:25 +0000
Subject: Re: Array access on function returns
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-37138@lists.php.net to get a copy of this message
On Fri, 2008-04-18 at 10:40 -0700, Kalle Sommer Nielsen wrote: > Hey Internals > > I've been wondering for quite some time why PHP doesn't allow you to access > arrays when you assign it to a value like in Javascript: > > function ArrayTest(Array $range) > { > return($range); > } > > $range = Array(1337 => Array('Hello World')); > > echo ArrayTest($range)[1337}; I was just about to write an email asking this same exact question this afternoon. This could be very useful, I don't see any reason not to have it. > > I would really like to see this introduced in PHP sometime (Perhaps as > an extra addition to 5.3's new and sleek features). > > This is very useful in a few areas and can save a few lines of code > here and there. > > unfortunately Im not a C Programmer myself else I've would have > provided a patch for this =/ > > > Cheers > > Kalle Sommer Nielsen > Zend Certified Engineer > >

« previous php.internals (#37138) next »