3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function distanceGeoPoints ($lat1, $lng1, $lat2, $lng2) { $earthRadius = 3958.75; $dLat = deg2rad($lat2-$lat1); $dLng = deg2rad($lng2-$lng1); $a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($dLng/2) * sin($dLng/2); $c = 2 * atan2(sqrt($a), sqrt(1-$a)); $dist = $earthRadius * $c; // from miles $meterConversion = 1609; $geopointDistance = $dist * $meterConversion; return $geopointDistance; } // YOUR CODE HERE echo distanceGeoPoints(53.2168710816799, 6.5573533796185, 53.1402726806595, 6.5633787486733); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
8524.9781525601
Output for hhvm-3.10.0

Process exited with code 153.