/ Published in: PHP
find the distance between two location using php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) { $theta = $longitude1 - $longitude2; $miles = $miles * 60 * 1.1515; $feet = $miles * 5280; $yards = $feet / 3; $kilometers = $miles * 1.609344; $meters = $kilometers * 1000; } $distance = getDistanceBetweenPointsNew($point1['lat'], $point1['long'], $point2['lat'], $point2['long']); foreach ($distance as $unit => $value) { } The example returns the following: miles: 2.6025 feet: 13,741.4350 yards: 4,580.4783 kilometers: 4.1884 meters: 4,188.3894
URL: http://www.inkplant.com/code/calculate-the-distance-between-two-points.php