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; } 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 U5PMq
Output for 5.6.28, 7.0.20 - 7.2.0
0.05883455489991
Output for 7.0.6
1.2024129114417E-5
Output for 7.0.5
2.0681687038949E-5
Output for 7.0.4
3.1843867946142E-5
Output for 7.0.3
2.685767011433E-5
Output for 7.0.2
2.480890184179E-5
Output for 7.0.1
2.4317911859764E-5
Output for 7.0.0
2.3086181803695E-5
Output for 5.6.21
1.4384627122752E-5
Output for 5.6.20
1.8732967917771E-5
Output for 5.6.19
3.3920422155052E-5
Output for 5.6.18
2.8726581297181E-5
Output for 5.6.17
2.6279675591425E-5
Output for 5.6.16
2.2694595475998E-5
Output for 5.6.15
2.2315917579378E-5
Output for 5.6.14
1.7684617361521E-5
Output for 5.6.13
1.7455051997397E-5
Output for 5.6.12
1.6497059629254E-5
Output for 5.6.11
1.5698285447171E-5
Output for 5.6.10
1.5507035463892E-5
Output for 5.6.9
1.512920953031E-5
Output for 5.6.8
1.4750008797635E-5
Output for 5.5.35
1.1864954509097E-5
Output for 5.5.34
1.8459732154453E-5
Output for 5.5.33
3.3007081866706E-5
Output for 5.5.32
2.7489786177692E-5
Output for 5.5.31
2.5726510698153E-5
Output for 5.5.30
2.126087912829E-5
Output for 5.5.29
1.7111102332802E-5
Output for 5.5.28
1.6276065039096E-5
Output for 5.5.27
1.6074403330923E-5
Output for 5.5.26
1.5316032081394E-5
Output for 5.5.25
1.4934008493907E-5
Output for 5.5.24
1.1733704365649E-5
Output for 5.4.45
0.058603831155205
Output for 5.4.44
0.058546432691781
Output for 5.4.42 - 5.4.43
0.058489146554118
Output for 5.4.41
0.058460545504458
Output for 5.4.40
0.058403427238211
Output for 5.4.38 - 5.4.39
0.058374909939755
Output for 5.4.37
0.058346420476631
Output for 5.4.36
0.058317958808106
Output for 5.4.34 - 5.4.35
0.058289524893524
Output for 5.3.29, 5.4.32
0.058232740163964
Output for 5.4.30 - 5.4.31
0.058204389268071
Output for 5.4.28 - 5.4.29
0.058176065964291
Output for 5.4.26 - 5.4.27
0.058147770212362
Output for 5.4.24 - 5.4.25
0.058119501972104
Output for 5.3.28, 5.4.23
0.05809126120341
Output for 5.4.21 - 5.4.22
0.058063047866254
Output for 5.4.19 - 5.4.20
0.058034861920688
Output for 5.3.27, 5.4.18
0.05800670332684
Output for 5.3.26, 5.4.17
0.057978572044916
Output for 5.3.24 - 5.3.25, 5.4.14 - 5.4.16
0.0579504680352
Output for 5.3.22 - 5.3.23, 5.4.12 - 5.4.13
0.057922391258051