I am sure I am missing something simple here but am having trouble grabbing values from an object that contains several nested arrays.
Here is the object being assigned:
$obj = json_decode($uri); // Convert JSON
Here is the print_r from this object:
Array ( [0] => stdClass Object ( [total] => 1 [results] => Array ( [0] => stdClass Object ( [coordinates] => Array ( [0] => -88.359306 [1] => 41.685747 ) [country_id] => US [state_id] => IL [address_locality] => Oswego [address_text] => 201Washington St [street_number] => 201 [street_name] => Washington St [confidence] => 0.71 [county_id] => 17093 [_type] => geo.place [geo_geometry_type] => Point ) ) ) )
I am having trouble getting at the values for county_id, coordinates, etc…
I was trying to use something like $obj->results[0]->coordinates[0]…. but this didnt work
Are you just missing the
[0]after $obj?