codacopia
codacopia

Reputation: 2501

Need help decoding JSON output with PHP

Here is the sample JSON output I am working with:

http://maps.google.com/maps/api/geocode/json?components=postal_code:90210&sensor=false

Here is the attempt to pull the latitude value from this location:

$postalLong = $jsonOutput>results[0]->formatted_address[0]->location[1]->lng;   

I have tried several variations but it is not working. How can I have this apply the 34.1030032 value to this variable?

Upvotes: 0

Views: 36

Answers (1)

Parag Tyagi
Parag Tyagi

Reputation: 8970

I guess you have mismatched it. Try this -

$json->results[0]->geometry->location->lat;

Upvotes: 1

Related Questions