Basic JSON Decode foreach loop not working php

Clash Royale CLAN TAG#URR8PPPBasic JSON Decode foreach loop not working php
been going at this for quite some time and I'm puzzled as to why using foreach loops does not work but the other way I show does work.
My Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://maps.googleapis.com/maps/api/geocode/json?address=1%20The%20Strand%20Wellard");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json"
));
$response = curl_exec($ch);
$json = json_decode($response, true);
foreach ($json['results'] as $item) {
foreach ($item['geometry'] as $item2) {
foreach ($item2['location'] as $item3) {
echo $item3['lat'];
}
}
echo $item['geometry']['location']['lat'];
}
curl_close($ch);
JSON Data: https://pastebin.com/JU1wSpsD
Why doesn't echo $item3['lat']; work but echo $item['geometry']['location']['lat']; does work? If someone could help me understand why this is that would be great!
echo $item3['lat'];
echo $item['geometry']['location']['lat'];
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
add json data. to question.
– prasanna puttaswamy
13 mins ago