3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $coords = array( 'DFW' => array('lat'=>52.989, 'long'=>16.910), 'LAX' => array('lat'=>53.149, 'long'=>16.739), ); //Chodzież -Piła // Change 3959 to 6371 to get the distance in kilometers $distance = (6371 * acos( cos(deg2rad($coords['DFW']['lat'])) * cos(deg2rad($coords['LAX']['lat'])) * cos(deg2rad($coords['LAX']['long']) - deg2rad($coords['DFW']['long'])) + sin(deg2rad($coords['DFW']['lat'])) * sin(deg2rad($coords['LAX']['lat'])) ) ); var_dump($distance); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
float(21.14360853289)