Access inner array in php -


i have folowing array:

outerarray{             "id": "20154",              "from": {               "name": "xyz",                "id": "10004"             }} 

now how access element name?

it json, decode first using json_decode() , access:

$arr = json_decode($yourjson, true); echo $arr['from']['name']; // xyz 

or

$arr = json_decode($yourjson); echo $arr->from->name; // xyz 

http://php.net/manual/en/function.json-decode.php


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -