Get item from PHP array without loop
In JavaScript, if I have object or array from JSON
var arr = ["one", "two", "three"];
var obj = {"hello": "dolly", "jurassic": "park"}
I can get any individual item from it easily without looping:
alert(arr[1]); // outputs "two"
alert(obj["hello"]); // outputs "dolly"
Is there a similar way to do this in PHP?
echo arr[1];
echo obj["hello"];
echo arr->1
echo obj->"hello"
No comments:
Post a Comment