title: how to parse JSON google maps JSON in php
body: <p>how to parse JSON google maps JSON in php</p>
  
  <p>i have do it in xml, but the coordinates driving direction's not complete as i get with JSON, how we can get all coordinate driving with JSON in php?</p>
  
  <p>if we do using xml</p>
  
  <pre><code>$xml = simplexml_load_file('http://maps.googleapis.com/maps/api/directions/xml?origin='.$origin.'&amp;destination='.$dest.'&amp;sensor=false');
  $startlat = $xml-&gt;xpath("/DirectionsResponse/route/leg/step/start_location/lat");
  $startlng = $xml-&gt;xpath("/DirectionsResponse/route/leg/step/start_location/lng");
  $distanceeach = $xml-&gt;xpath("/DirectionsResponse/route/leg/step/distance/value");
  $distance = $xml-&gt;xpath("/DirectionsResponse/route/leg/distance/value");
  </code></pre>
  
  <p>but how to do with json?
  and i want my variable $startlat, $startlng, etc, contains same value if we do with xml</p>