title: Parse json and convert it to php array
body: <p>I am trying to echo a value from google map json url. I can var_dump() the keys and the values but I can't pull the specific value alone. Php code:</p>
  
  <pre><code>&lt;?php
      $from = 'Piccadilly+Circus+London+UK';
      $to = 'Brighton+Railway+Station+Brighton+UK';
      $json ='https://maps.googleapis.com/maps/api/distancematrix/json?origins='.$from.'&amp;destinations='.$to.'&amp;mode=driving&amp;key=APIKEY';
      $ch = curl_init($json);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      $data = curl_exec($ch);
      curl_close($ch);
  
      // Print Result
      echo '&lt;pre&gt;' . var_dump($data) . '&lt;/pre&gt;';
  
  ?&gt;
  </code></pre>
  
  <p>The var_dump() result is as follows;</p>
  
  <pre><code>       string(542) "{
         "destination_addresses" : [ "Brighton, Queens Rd, Brighton BN1 3XP, UK" ],
         "origin_addresses" : [ "Piccadilly Circus, London W1B, UK" ],
         "rows" : [
            {
               "elements" : [
                  {
                     "distance" : {
                        "text" : "86.7 km",
                        "value" : 86665
                     },
                     "duration" : {
                        "text" : "1 hour 59 mins",
                        "value" : 7114
                     },
                     "status" : "OK"
                  }
               ]
            }
         ],
         "status" : "OK"
      }
      "
  </code></pre>
  
  <p>I need to assign <strong>distance->text</strong> to a php variable. Could anyone help?</p>