Skip to content

Instantly share code, notes, and snippets.

View atomoc's full-sized avatar

Сергей Савельев atomoc

View GitHub Profile
<?php
function LatLngDist($p, $q) {
$R = 6371; // Earth radius in km
$dLat = (($q[0] - $p[0]) * pi() / 180);
$dLon = (($q[1] - $p[1]) * pi() / 180);
$a = sin($dLat / 2) * sin($dLat / 2) +
cos($p[0] * pi() / 180) * cos($q[0] * pi() / 180) *
sin($dLon / 2) * sin($dLon / 2);