0

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" which is the third id right after "Danielle McPherson". How do I do that?

5
  • 1
    After cleaning up your output (use code tags!), your question became a lot more clear. Commented Aug 3, 2011 at 12:24
  • @K4emic: How is your edit substantially better than mine? ;) (this is not a JSON string, for example) Commented Aug 3, 2011 at 12:31
  • itslikewhenyoudontevencareaboutwhitespaceanymore. Commented Aug 3, 2011 at 12:34
  • @K4emic: Have a look at the edit history. ;-) Commented Aug 3, 2011 at 12:36
  • Your edit is superior to mine, but the editor presented me with the original text, not your edit. Shouldn't the editor notify me that new edits were made? Apologies for the previous, slightly rude, comment. Commented Aug 3, 2011 at 12:42

1 Answer 1

4

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'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.