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 rbm7F
Output for 5.6.28, 7.0.20 - 7.2.0
1.4871848479452E-8
Output for 7.0.6
3.3403540209791E-12
Output for 7.0.5
5.7458543800767E-12
Output for 7.0.4
8.8477577314994E-12
Output for 7.0.3
7.4620531216597E-12
Output for 7.0.2
6.892720454312E-12
Output for 7.0.1
6.756283839489E-12
Output for 7.0.0
6.4140036941427E-12
Output for 5.6.21
3.9961841368699E-12
Output for 5.6.20
5.2043736533531E-12
Output for 5.6.19
9.4248825763882E-12
Output for 5.6.18
7.9814278470531E-12
Output for 5.6.17
7.3014314152863E-12
Output for 5.6.16
6.3051985541804E-12
Output for 5.6.15
6.1999712216081E-12
Output for 5.6.14
4.9130812303247E-12
Output for 5.6.13
4.8492953387917E-12
Output for 5.6.12
4.583114840595E-12
Output for 5.6.11
4.3611771591099E-12
Output for 5.6.10
4.3080300878132E-12
Output for 5.6.9
4.2030619073603E-12
Output for 5.6.8
4.0977034356536E-12
Output for 5.5.35
3.2961213243999E-12
Output for 5.5.34
5.1284532801191E-12
Output for 5.5.33
9.1710418167241E-12
Output for 5.5.32
7.6377218816583E-12
Output for 5.5.31
7.1477111144483E-12
Output for 5.5.30
5.9067934868636E-12
Output for 5.5.29
4.7537289885434E-12
Output for 5.5.28
4.5217029123068E-12
Output for 5.5.27
4.4656812492802E-12
Output for 5.5.26
4.2549690327885E-12
Output for 5.5.25
4.1488259641662E-12
Output for 5.5.24
3.2596652954145E-12
Output for 5.4.45
1.4851895194372E-8
Output for 5.4.44
1.4845255992229E-8
Output for 5.4.42 - 5.4.43
1.4838622723242E-8
Output for 5.4.41
1.4831995379462E-8
Output for 5.4.39 - 5.4.40
1.4825373952954E-8
Output for 5.4.36 - 5.4.38
1.4818758435795E-8
Output for 5.4.34 - 5.4.35
1.4812148820078E-8
Output for 5.3.29, 5.4.32
1.4805545097912E-8
Output for 5.4.28 - 5.4.31
1.4798947261415E-8
Output for 5.4.24 - 5.4.27
1.4792355302724E-8
Output for 5.3.28, 5.4.21 - 5.4.23
1.4785769213987E-8
Output for 5.3.27, 5.4.18 - 5.4.20
1.4779188987368E-8
Output for 5.3.24 - 5.3.26, 5.4.13 - 5.4.17
1.4772614615043E-8
Output for 5.3.22 - 5.3.23, 5.4.12
1.4766046089202E-8