3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $Fecha = "2016-01-27 11:50:19"; 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 Oa40j
Output for 5.6.28, 7.0.20 - 7.2.0
0.058661342275082
Output for 7.0.6
1.2025274475525E-5
Output for 7.0.5
2.0685075768276E-5
Output for 7.0.4
3.1851944805885E-5
Output for 7.0.3
2.6863403310433E-5
Output for 7.0.2
2.4813798785796E-5
Output for 7.0.1
2.432263171896E-5
Output for 7.0.0
2.3090417758631E-5
Output for 5.6.21
1.4386264623902E-5
Output for 5.6.20
1.8735745152071E-5
Output for 5.6.19
3.3929586904433E-5
Output for 5.6.18
2.8733154060871E-5
Output for 5.6.17
2.6285164653359E-5
Output for 5.6.16
2.2698719104744E-5
Output for 5.6.15
2.2319900564835E-5
Output for 5.6.14
1.7687092429169E-5
Output for 5.6.13
1.7457465768863E-5
Output for 5.6.12
1.6499213426142E-5
Output for 5.6.11
1.5700237772796E-5
Output for 5.6.10
1.5508908316127E-5
Output for 5.6.9
1.5131022866497E-5
Output for 5.6.8
1.4751732368353E-5
Output for 5.5.35
1.186603676784E-5
Output for 5.5.34
1.8462431808429E-5
Output for 5.5.33
3.3015759657927E-5
Output for 5.5.32
2.7495805097748E-5
Output for 5.5.31
2.573177108878E-5
Output for 5.5.30
2.1264456552709E-5
Output for 5.5.29
1.7113424358756E-5
Output for 5.5.28
1.6278130484304E-5
Output for 5.5.27
1.6076452497409E-5
Output for 5.5.26
1.5317888518039E-5
Output for 5.5.25
1.4935773470998E-5
Output for 5.5.24
1.1734795063492E-5
Output for 5.4.45
0.058575117862135
Output for 5.4.44
0.058546432691781
Output for 5.4.41 - 5.4.43
0.058517775602847
Output for 5.4.40
0.058489146554118
Output for 5.4.38 - 5.4.39
0.058460545504458
Output for 5.4.35 - 5.4.37
0.058431972412814
Output for 5.4.32 - 5.4.34
0.058403427238211
Output for 5.3.29, 5.4.28 - 5.4.31
0.058374909939755
Output for 5.4.24 - 5.4.27
0.058346420476631
Output for 5.3.28, 5.4.21 - 5.4.23
0.058317958808106
Output for 5.4.18 - 5.4.20
0.058289524893524
Output for 5.3.25 - 5.3.27, 5.4.15 - 5.4.17
0.058261118692309
Output for 5.3.22 - 5.3.24, 5.4.12 - 5.4.14
0.058232740163964