PHP: Array access short-hand?
Posted
by motionman95
on Stack Overflow
See other posts from Stack Overflow
or by motionman95
Published on 2010-03-20T23:58:09Z
Indexed on
2010/03/21
0:01 UTC
Read the original article
Hit count: 397
In Javascript, after executing a function I can immediately get the an element of the array returned by the function, like so:
myFunc("birds")[0] //gets element zero returned from "myFunc()"
This is much easier and faster than doing this:
$myArray = myFunc("birds");
echo $myArray[0];
Does PHP have a similar shorthand to javascript? I'm just curious. Thanks in advance!
© Stack Overflow or respective owner