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){ $Velocidad = $Distancia / $Tiempo; $Velocidad = ($Velocidad / 1000) * 3600; return $Velocidad; } 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 ZjWET
Output for 5.6.28, 7.0.20 - 7.2.0
0.19851777490951
Output for 7.0.6
4.3290970693975E-5
Output for 7.0.5
7.446620834439E-5
Output for 7.0.4
0.0001146669707507
Output for 7.0.3
9.6708230187129E-5
Output for 7.0.2
8.9329657087883E-5
Output for 7.0.1
8.7561456374013E-5
Output for 7.0.0
8.3125487876089E-5
Output for 5.6.21
5.1790521484993E-5
Output for 5.6.20
6.7448640266189E-5
Output for 5.6.19
0.00012214647818999
Output for 5.6.18
0.00010343932975847
Output for 5.6.17
9.4626571947098E-5
Output for 5.6.16
8.1715388777077E-5
Output for 5.6.15
8.0351627032041E-5
Output for 5.6.14
6.3673447963499E-5
Output for 5.6.13
6.2846830882097E-5
Output for 5.6.12
5.939713554478E-5
Output for 5.6.11
5.6520826291493E-5
Output for 5.6.10
5.5832040966721E-5
Output for 5.6.9
5.4471647848489E-5
Output for 5.6.8
5.3106203761678E-5
Output for 5.5.35
4.2717673005419E-5
Output for 5.5.34
6.6464713453661E-5
Output for 5.5.33
0.00011885670194474
Output for 5.5.32
9.8984875586291E-5
Output for 5.5.31
9.2634355981425E-5
Output for 5.5.30
7.6551989125119E-5
Output for 5.5.29
6.1608292415476E-5
Output for 5.5.28
5.8601237827005E-5
Output for 5.5.27
5.787519786014E-5
Output for 5.5.26
5.5144370402873E-5
Output for 5.5.25
5.3768757625973E-5
Output for 5.5.24
4.2245249788627E-5
Output for 5.4.45
0.19824345278849
Output for 5.4.43 - 5.4.44
0.19815218048058
Output for 5.4.41 - 5.4.42
0.19806099217847
Output for 5.4.40
0.19796988776625
Output for 5.4.37 - 5.4.39
0.19787886712819
Output for 5.4.35 - 5.4.36
0.19778793014882
Output for 5.4.32 - 5.4.34
0.19769707671283
Output for 5.3.29, 5.4.28 - 5.4.31
0.19760630670515
Output for 5.4.25 - 5.4.27
0.19751562001093
Output for 5.3.28, 5.4.21 - 5.4.24
0.19742501651551
Output for 5.4.18 - 5.4.20
0.19733449610446
Output for 5.3.25 - 5.3.27, 5.4.15 - 5.4.17
0.19724405866353
Output for 5.3.22 - 5.3.24, 5.4.12 - 5.4.14
0.19715370407871