title: get value from array - google API PHP result
body: <p>I am trying to get the driving distance from google maps.</p>
  
  <p><code>print_r($result);</code> outputs the below:</p>
  
  <pre><code>Array
      (
          [0] =&gt; Array
              (
                  [elements] =&gt; Array
                      (
                          [0] =&gt; Array
                              (
                                  [distance] =&gt; Array
                                      (
                                          [text] =&gt; 3,936 km
                                          [value] =&gt; 3935862
                                      )
  
                                  [duration] =&gt; Array
                                      (
                                          [text] =&gt; 1 day 18 hours
                                          [value] =&gt; 150860
                                      )
  
                                  [status] =&gt; OK
                              )
  
                      )
  
              )
  
      )
  </code></pre>
  
  <p>my php code to produce this is:</p>
  
  <pre><code>$q = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=Sydney&amp;destinations=Perth&amp;mode=driving&amp;sensor=false";
  $json = file_get_contents($q);
  $details = json_decode($json, TRUE);
  $details=$details['rows'];
  print_r($details);
  </code></pre>
  
  <p>I somehow need to access this array and get the distance text value, in this case <code>3936 km</code></p>
  
  <p>Any help appreciated,
  Thanks as always</p>