3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 strtotime('now') - $Fecha; ?>
based on TtOCa
Output for 5.6.28, 7.0.20 - 7.2.0
319
Output for 7.0.6
9941076
Output for 7.0.5
5778982
Output for 7.0.4
3752727
Output for 7.0.3
4449724
Output for 7.0.2
4817322
Output for 7.0.1
4914618
Output for 7.0.0
5176915
Output for 5.6.21
8309501
Output for 5.6.20
6380312
Output for 5.6.19
3522893
Output for 5.6.18
4160128
Output for 5.6.17
4547626
Output for 5.6.16
5266264
Output for 5.6.15
5355661
Output for 5.6.14
6758633
Output for 5.6.13
6847542
Output for 5.6.12
7245274
Output for 5.6.11
7614015
Output for 5.6.10
7707939
Output for 5.6.9
7900470
Output for 5.6.8
8103621
Output for 5.5.35
10074463
Output for 5.5.34
6474775
Output for 5.5.33
3620420
Output for 5.5.32
4347368
Output for 5.5.31
4645442
Output for 5.5.30
5621507
Output for 5.5.29
6985216
Output for 5.5.28
7343671
Output for 5.5.27
7435821
Output for 5.5.26
7804083
Output for 5.5.25
8003758
Output for 5.5.24
10187171
Output for 5.4.45
325
Output for 5.4.44
326
Output for 5.4.42 - 5.4.43
327
Output for 5.4.41
328
Output for 5.4.40
329
Output for 5.4.38 - 5.4.39
330
Output for 5.4.36 - 5.4.37
331
Output for 5.4.34 - 5.4.35
332
Output for 5.3.29, 5.4.32
333
Output for 5.4.28 - 5.4.31
334
Output for 5.4.25 - 5.4.27
335
Output for 5.3.28, 5.4.23 - 5.4.24
336
Output for 5.4.19 - 5.4.22
337
Output for 5.3.26 - 5.3.27, 5.4.17 - 5.4.18
338
Output for 5.3.23 - 5.3.25, 5.4.13 - 5.4.16
339
Output for 5.3.22, 5.4.12
340