3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Fecha = 1453892442; 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 $Tiempo; ?>
Output for 5.6.28, 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
1453892546
Output for 7.0.6
1463833524
Output for 7.0.5
1459671429
Output for 7.0.4
1457645165
Output for 7.0.3
1458342161
Output for 7.0.2
1458709759
Output for 7.0.1
1458807056
Output for 7.0.0
1459069353
Output for 5.6.21
1462201949
Output for 5.6.20
1460272760
Output for 5.6.19
1457415331
Output for 5.6.18
1458052566
Output for 5.6.17
1458440061
Output for 5.6.16
1459158703
Output for 5.6.15
1459248095
Output for 5.6.14
1460651082
Output for 5.6.13
1460739990
Output for 5.6.12
1461137722
Output for 5.6.11
1461506463
Output for 5.6.10
1461600402
Output for 5.6.9
1461792919
Output for 5.6.8
1461996069
Output for 5.5.35
1463966922
Output for 5.5.34
1460367223
Output for 5.5.33
1457512858
Output for 5.5.32
1458239805
Output for 5.5.31
1458537876
Output for 5.5.30
1459513955
Output for 5.5.29
1460877664
Output for 5.5.28
1461236133
Output for 5.5.27
1461328268
Output for 5.5.26
1461696532
Output for 5.5.25
1461896206
Output for 5.5.24
1464079618

preferences:
168.08 ms | 401 KiB | 184 Q