3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $Fecha = "2016-01-27 11:34:19"; function CalcularTiempo($Timestamp){ $Segundos = strtotime('now') - strtotime($Timestamp); return intval($Segundos); } function CalcularVelocidad($Distancia, $Tiempo){ return ($Distancia / $Tiempo) / 1000; } 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 K9qiH
Output for 5.6.28, 7.0.20 - 7.2.0
5.761533279837E-5
Output for 7.0.6
1.2024125486376E-8
Output for 7.0.5
2.0681676305563E-8
Output for 7.0.4
3.18438594642E-8
Output for 7.0.3
2.6857664080676E-8
Output for 7.0.2
2.480889669355E-8
Output for 7.0.1
2.4317911859764E-8
Output for 7.0.0
2.3086177345614E-8
Output for 5.6.21
1.4384620199649E-8
Output for 5.6.20
1.8732956176457E-8
Output for 5.6.19
3.3920422155052E-8
Output for 5.6.18
2.8726574394599E-8
Output for 5.6.17
2.6279669814673E-8
Output for 5.6.16
2.2694617016664E-8
Output for 5.6.15
2.2315938407194E-8
Output for 5.6.14
1.768460689759E-8
Output for 5.6.13
1.7455041803368E-8
Output for 5.6.12
1.6497050523484E-8
Output for 5.6.11
1.5698277201841E-8
Output for 5.6.10
1.5507027418241E-8
Output for 5.6.9
1.5129203786536E-8
Output for 5.6.8
1.4750001518359E-8
Output for 5.5.35
1.1864947443856E-8
Output for 5.5.34
1.8459720753154E-8
Output for 5.5.33
3.3007072753777E-8
Output for 5.5.32
2.7489779856682E-8
Output for 5.5.31
2.5726505162033E-8
Output for 5.5.30
2.1260864004315E-8
Output for 5.5.29
1.7111092536559E-8
Output for 5.5.28
1.6276056175654E-8
Output for 5.5.27
1.6074396847048E-8
Output for 5.5.26
1.5316024232723E-8
Output for 5.5.25
1.4934001031888E-8
Output for 5.5.24
1.1733700910751E-8
Output for 5.4.45
5.747683440222E-5
Output for 5.4.44
5.7449214587514E-5
Output for 5.4.42 - 5.4.43
5.7421621304811E-5
Output for 5.4.41
5.7394054515899E-5
Output for 5.4.40
5.7366514182638E-5
Output for 5.4.38 - 5.4.39
5.7339000266963E-5
Output for 5.4.36 - 5.4.37
5.7311512730881E-5
Output for 5.4.34 - 5.4.35
5.7284051536472E-5
Output for 5.3.29, 5.4.31 - 5.4.32
5.7256616645889E-5
Output for 5.4.27 - 5.4.30
5.7229208021358E-5
Output for 5.4.24 - 5.4.26
5.7201825625176E-5
Output for 5.3.28, 5.4.21 - 5.4.23
5.7174469419712E-5
Output for 5.3.27, 5.4.18 - 5.4.20
5.7147139367408E-5
Output for 5.3.24 - 5.3.26, 5.4.15 - 5.4.17
5.7119835430777E-5
Output for 5.3.22 - 5.3.23, 5.4.12 - 5.4.14
5.7092557572406E-5