3v4l.org

run code in 300+ PHP versions simultaneously
<?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; // meters to km $geopointDistance = round($geopointDistance / 1000); return $geopointDistance; } // input here echo distanceGeoPoints(53.2168710816799, 6.5573533796185, 53.1402726806595, 6.5633787486733). ' km'; ?>
Output for git.master, git.master_jit, rfc.property-hooks
9 km

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.77 ms | 401 KiB | 8 Q