
PHP
4
Вклад в тег
public function getDistance(float $latitudeFrom, float $longitudeFrom, float $latitudeTo, float $longitudeTo): int
{
$rad = M_PI / 180;
$theta = $longitudeFrom - $longitudeTo;
$dist = sin($latitudeFrom * $rad) * sin($latitudeTo * $rad) + cos($latitudeFrom * $rad) * cos($latitudeTo * $rad) * cos($theta * $rad);
return acos($dist) / $rad * 60 * 1.853;
}