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

Glib GIOChannel -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -

python - Obscure curses error message when creating a sub window -