3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $Fecha = 1453892442; function CalcularTiempo($Timestamp){ $Segundos = strtotime('now') - strtotime($Timestamp); return intval($Segundos); } function CalcularVelocidad($Distancia, $Tiempo){ return $Distancia / $Tiempo; } function CalcularDistancia($OrigenLat, $OrigenLon, $DestinoLat, $DestinoLon){ $R = 6371; $dLat = ($DestinoLat - $OrigenLat) * (pi() / 180); $dLon = ($DestinoLon - $OrigenLon) * (pi() / 180); $a = sin($dLat / 2) * sin($dLat / 2) + cos($OrigenLat * (pi() / 180)) * cos($DestinoLat * (pi() / 180)) * sin($dLon / 2) * sin($dLon / 2); $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); return ($R * $c) * 1000; } $Tiempo = CalcularTiempo($Fecha); $Distancia = CalcularDistancia(38.278096798610605,-0.6911851008339024,38.2788421664234,-0.6901980479164007); $Velocidad = CalcularVelocidad($Distancia, $Tiempo); echo $Velocidad; ?>
based on 82uQv
Output for 5.6.28, 7.0.20 - 7.2.0
8.2228784571062E-8
Output for 7.0.6
8.1670363470217E-8
Output for 7.0.5
8.1903237611586E-8
Output for 7.0.4
8.2017090484832E-8
Output for 7.0.3
8.1977891408355E-8
Output for 7.0.2
8.1957232803257E-8
Output for 7.0.1
8.1951766560939E-8
Output for 7.0.0
8.1937034142299E-8
Output for 5.6.21
8.1761494058455E-8
Output for 5.6.20
8.186951043719E-8
Output for 5.6.19
8.2030024557603E-8
Output for 5.6.18
8.1994173722149E-8
Output for 5.6.17
8.1972388349515E-8
Output for 5.6.16
8.1932016816921E-8
Output for 5.6.15
8.1926997354946E-8
Output for 5.6.14
8.1848305540575E-8
Output for 5.6.13
8.1843323784018E-8
Output for 5.6.12
8.1821045453594E-8
Output for 5.6.11
8.1800401840316E-8
Output for 5.6.10
8.1795145259217E-8
Output for 5.6.9
8.1784372118253E-8
Output for 5.6.8
8.1773007807918E-8
Output for 5.5.35
8.166292220585E-8
Output for 5.5.34
8.1864214755756E-8
Output for 5.5.33
8.2024535657694E-8
Output for 5.5.32
8.19836455573E-8
Output for 5.5.31
8.196689108727E-8
Output for 5.5.30
8.1912074603067E-8
Output for 5.5.29
8.1835610819357E-8
Output for 5.5.28
8.1815535772214E-8
Output for 5.5.27
8.1810376560689E-8
Output for 5.5.26
8.1789765132559E-8
Output for 5.5.25
8.1778593770774E-8
Output for 5.5.24
8.1656635618326E-8
Output for 5.4.45
8.2228784401389E-8
Output for 5.4.44
8.2228784344831E-8
Output for 5.4.41 - 5.4.43
8.2228784288273E-8
Output for 5.4.40
8.2228784231716E-8
Output for 5.4.38 - 5.4.39
8.2228784175158E-8
Output for 5.4.36 - 5.4.37
8.22287841186E-8
Output for 5.4.34 - 5.4.35
8.2228784062043E-8
Output for 5.3.29, 5.4.31 - 5.4.32
8.2228784005485E-8
Output for 5.4.27 - 5.4.30
8.2228783948927E-8
Output for 5.4.24 - 5.4.26
8.222878389237E-8
Output for 5.3.28, 5.4.20 - 5.4.23
8.2228783835812E-8
Output for 5.3.27, 5.4.17 - 5.4.19
8.2228783779254E-8
Output for 5.3.24 - 5.3.26, 5.4.14 - 5.4.16
8.2228783722697E-8
Output for 5.3.22 - 5.3.23, 5.4.12 - 5.4.13
8.2228783666139E-8