Skip to content

Instantly share code, notes, and snippets.

View Mehedimuaz's full-sized avatar

Mehedi Hasan Mehedimuaz

  • Dhaka, Bangladesh
View GitHub Profile
function distanceGeoPoints ($long1, $lat1, $long2, $lat2) {
$lat = deg2rad($lat2 - $lat1);
$long = deg2rad($long2 - $long1);
$a = sin($lat/2) * sin($lat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($long/2) * sin($long/2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$d = 6371 * $c;
return $d;
}