Get specific element in Json string in php problem
This is my data struuture:
array(6) {
["id"]=> string(15) "264729823543848"
["application"]=> array(2) {
["name"]=> string(7) "Prizzer"
["id"]=> string(15) "100398126714422"
}
["to"]=> array(2) {
["name"]=> string(18) "Danielle McPherson"
["id"]=> string(15) "100000204975672"
}
["from"]=> array(2) {
["name"]=> string(13) "Billy Zearott"
["id"]=> string(10) "1292797153"
}
["message"]=> string(45) "Become my Prizzer Buddie and win Real Prizes!"
["created_time"]=> string(24) "2011-08-02T06:06:39+0000"
}
I get this by dumping the var:
$obj = json_decode($returned_content, true);
var_dump($obj);
Now I need to extract only the value "100000204975672"
w开发者_开发百科hich is the third id right after "Danielle McPherson"
. How do I do that?
I had to look at your example a couple of times because of the nesting. Thanks for the edit @K4emic - much easier to read now.
echo $obj['to']['id'];
精彩评论