Array access on function returns
| From: | Kalle Sommer Nielsen | Date: | Fri, 18 Apr 2008 17:40:18 +0000 |
| Subject: | Array access on function returns | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-37137@lists.php.net to get a copy of this message | ||
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 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