r/PHPhelp • u/ryancwarren • Jul 26 '11
array question
New to php
function ReturnsArrayNotEmpty()...
Why can't I reference elements in the array like the following:
$value = $this->ReturnsArrayNotEmpty()[0];
?
Whereas, this works fine,
$value = $this->ReturnsArrayNotEmpty(); $another = $value[0];
8
Upvotes
1
u/ryancwarren Jul 26 '11
http://stackoverflow.com/questions/13109/php-access-array-value-on-the-fly
http://stackoverflow.com/questions/1459924/when-a-php-function-returns-an-array-can-i-access-its-elements-inline
Not possible because of the language.