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){ $salida = $Distancia / $Tiempo; return $salida / 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; echo '\n'; echo round(7.6734156326455); ?>
based on T0PZ6
Output for 5.6.28, 7.0.20 - 7.2.0
7.5142561632066E-5\n8
Output for 7.0.6
1.2025269637215E-8\n8
Output for 7.0.5
2.0685061452406E-8\n8
Output for 7.0.4
3.1851961778391E-8\n8
Output for 7.0.3
2.6863421419139E-8\n8
Output for 7.0.2
2.4813814236628E-8\n8
Output for 7.0.1
2.4322641615767E-8\n8
Output for 7.0.0
2.3090431137793E-8\n8
Output for 5.6.21
1.4386257699223E-8\n8
Output for 5.6.20
1.8735733407275E-8\n8
Output for 5.6.19
3.3929615792774E-8\n8
Output for 5.6.18
2.8733167872364E-8\n8
Output for 5.6.17
2.6285181990871E-8\n8
Output for 5.6.16
2.2698727724137E-8\n8
Output for 5.6.15
2.2319904731882E-8\n8
Output for 5.6.14
1.768706887875E-8\n8
Output for 5.6.13
1.7457455572015E-8\n8
Output for 5.6.12
1.6499204317995E-8\n8
Output for 5.6.11
1.5700229525415E-8\n8
Output for 5.6.10
1.5508900268534E-8\n8
Output for 5.6.9
1.5131015206296E-8\n8
Output for 5.6.8
1.4751725087376E-8\n8
Output for 5.5.35
1.1866021457036E-8\n8
Output for 5.5.34
1.8462420403795E-8\n8
Output for 5.5.33
3.301578701112E-8\n8
Output for 5.5.32
2.7495817745312E-8\n8
Output for 5.5.31
2.5731787703947E-8\n8
Output for 5.5.30
2.1264441423644E-8\n8
Output for 5.5.29
1.7113414559854E-8\n8
Output for 5.5.28
1.6278121618613E-8\n8
Output for 5.5.27
1.6076443850039E-8\n8
Output for 5.5.26
1.5317880667465E-8\n8
Output for 5.5.25
1.4935766007215E-8\n8
Output for 5.5.24
1.1734791607952E-8\n8
Output for 5.4.45
7.4766613856546E-5\n8
Output for 5.4.44
7.4719884722886E-5\n8
Output for 5.4.43
7.4626601471047E-5\n8
Output for 5.4.41 - 5.4.42
7.4580047134509E-5\n8
Output for 5.4.40
7.4487112496335E-5\n8
Output for 5.4.38 - 5.4.39
7.4440731977968E-5\n8
Output for 5.4.36 - 5.4.37
7.4394409182711E-5\n8
Output for 5.4.34 - 5.4.35
7.4348144002871E-5\n8
Output for 5.3.29, 5.4.30 - 5.4.32
7.4301936331024E-5\n8
Output for 5.4.27 - 5.4.29
7.4255786060011E-5\n8
Output for 5.4.23 - 5.4.26
7.4209693082941E-5\n8
Output for 5.3.28, 5.4.20 - 5.4.22
7.4163657293187E-5\n8
Output for 5.3.27, 5.4.18 - 5.4.19
7.4117678584388E-5\n8
Output for 5.3.24 - 5.3.26, 5.4.14 - 5.4.17
7.4071756850444E-5\n8
Output for 5.3.22 - 5.3.23, 5.4.12 - 5.4.13
7.4025891985522E-5\n8