title: Parsing particular value in JSON via PHP from Mapquest API
body: <p>I am having trouble targeting the particular value in the array.  I am trying to target the 'lng' and 'lat'.  I feel like I'm close, and have tried several different ways to target. Currently trying this:</p>
  
  <pre><code>$json = file_get_contents($jsonurl);
  $output = json_decode($json, true);
  
  $latitude=$output['results']['locations']['latLng'][0];
  $longitude=$output['results']['locations']['latLng'][1];
  </code></pre>
  
  <p>The JSON is:</p>
  
  <pre><code>array(3) {
    ["results"]=&gt;
    array(1) {
      [0]=&gt;
      array(2) {
        ["locations"]=&gt;
        array(1) {
          [0]=&gt;
          array(19) {
            ["latLng"]=&gt;
            array(2) {
              ["lng"]=&gt;
              float(-122.5008)
              ["lat"]=&gt;
              float(47.2629)
            }
            ["adminArea4"]=&gt;
            string(13) "Pierce County"
            ["adminArea5Type"]=&gt;
            string(4) "City"
            ["adminArea4Type"]=&gt;
            string(6) "County"
            ["adminArea5"]=&gt;
            string(6) "Tacoma"
            ["street"]=&gt;
            string(0) ""
            ["adminArea1"]=&gt;
            string(2) "US"
            ["adminArea3"]=&gt;
            string(2) "WA"
            ["type"]=&gt;
            string(1) "s"
            ["displayLatLng"]=&gt;
            array(2) {
              ["lng"]=&gt;
              float(-122.5008)
              ["lat"]=&gt;
              float(47.2629)
            }
            ["linkId"]=&gt;
            int(0)
            ["postalCode"]=&gt;
            string(5) "98406"
            ["sideOfStreet"]=&gt;
            string(1) "N"
            ["dragPoint"]=&gt;
            bool(false)
            ["adminArea1Type"]=&gt;
            string(7) "Country"
            ["geocodeQuality"]=&gt;
            string(3) "ZIP"
            ["geocodeQualityCode"]=&gt;
            string(5) "Z1XAA"
            ["mapUrl"]=&gt;
            string(186) "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2gu2ll,7w=o5-9uaauz&amp;type=map&amp;size=225,160&amp;pois=purple-1,47.2629,-122.5008,0,0|&amp;center=47.2629,-122.5008&amp;zoom=12&amp;rand=-8386350"
            ["adminArea3Type"]=&gt;
            string(5) "State"
          }
        }
        ["providedLocation"]=&gt;
        array(1) {
          ["location"]=&gt;
          string(5) "98406"
        }
      }
    }
    ["options"]=&gt;
    array(3) {
      ["ignoreLatLngInput"]=&gt;
      bool(false)
      ["maxResults"]=&gt;
      int(-1)
      ["thumbMaps"]=&gt;
      bool(true)
    }
    ["info"]=&gt;
    array(3) {
      ["copyright"]=&gt;
      array(3) {
        ["text"]=&gt;
        string(22) "Â© 2013 MapQuest, Inc."
        ["imageUrl"]=&gt;
        string(35) "http://api.mqcdn.com/res/mqlogo.gif"
        ["imageAltText"]=&gt;
        string(22) "Â© 2013 MapQuest, Inc."
      }
      ["statuscode"]=&gt;
      int(0)
      ["messages"]=&gt;
      array(0) {
      }
    }
  }
  </code></pre>