The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
<?php | |
function distance($lat1, $lng1, $lat2, $lng2) | |
{ | |
// convert latitude/longitude degrees for both coordinates | |
// to radians: radian = degree * π / 180 | |
$lat1 = deg2rad($lat1); | |
$lng1 = deg2rad($lng1); | |
$lat2 = deg2rad($lat2); | |
$lng2 = deg2rad($lng2); |