title: Efficient way to search this json array?
body: <p>My programmer is having trouble getting the <code>location</code> data (latitude and longitude) from this json array. What would a <code>foreach</code> loop be which would find the lat/long of <code>location:</code> and echo them? Thanks</p>
  
  <p><code>$jsonArray = json_decode($jsondata, true);</code></p>
  
  <pre><code>$jsondata =  {
         "results" : [
            {
               "address_components" : [
                  {
                     "long_name" : "2340",
                     "short_name" : "2340",
                     "types" : [ "postal_code" ]
                  },
                  {
                     "long_name" : "New South Wales",
                     "short_name" : "NSW",
                     "types" : [ "administrative_area_level_1", "political" ]
                  },
                  {
                     "long_name" : "Australia",
                     "short_name" : "AU",
                     "types" : [ "country", "political" ]
                  }
               ],
               "formatted_address" : "New South Wales 2340, Australia",
               "geometry" : {
                  "bounds" : {
                     "northeast" : {
                        "lat" : -30.79897870,
                        "lng" : 151.394080
                     },
                     "southwest" : {
                        "lat" : -31.661670,
                        "lng" : 150.334880
                     }
                  },
                  "location" : {
                     "lat" : -31.28146910,
                     "lng" : 151.04713550
                  },
                  "location_type" : "APPROXIMATE",
                  "viewport" : {
                     "northeast" : {
                        "lat" : -30.79897870,
                        "lng" : 151.394080
                     },
                     "southwest" : {
                        "lat" : -31.661670,
                        "lng" : 150.334880
                     }
                  }
               },
               "types" : [ "postal_code" ]
            }
         ],
         "status" : "OK"
      };
  </code></pre>