Php Json how to get property?
I have a json file.
I would like to get "Zangya" (which is in "animeName")
This gives me:
object(stdClass)#1 (26) { ["animeName"]=> array(1) { [0]=> string(6) "Zangya" } ["address"]=> NULL ["aliasName"]=> array(3) { [0]=> string(3) "Aki" [1]=> string(8) "Zangyaku" .......
2 Replies
I tried this:
I got it, thank you
be careful when using that parameter, as large arrays can use a whole lot more memory than an object, for some bizarre reason
php got a lot better on this aspect, but still, keep an eye out for it
so, instead of doing
$array['animeName'][0]
you can do $array->animeName[0]
, id you dont set it to decode to an array