Jump to content

Print out nested json variable


small

Recommended Posts

== PHP json decode ==

 

I'm trying to print a nested variable ("url") from a json response in php 5.3.

 

Json code

<code>

{

  "offset": "0",

  "results": [

    {

      "body": "body info",

      "date": "date info",

      "title": "title info",

      "url": "url info"

    }

  ],

  "total": 1

}

</code>

 

My current php code

$info = json_decode($jsonresponse);
print $info->{"results"}->{"url"};//this doesn't work

 

How would I print the value of the "url" variable in php? (This should be fairly simple...)

Link to comment
https://forums.phpfreaks.com/topic/193447-print-out-nested-json-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.