<?php
$Fecha = "2016-01-27 12:05:19";
function CalcularTiempo($Timestamp){
$Segundos = strtotime('now') - strtotime($Timestamp);
return intval($Segundos);
}
function CalcularVelocidad($Distancia, $Tiempo){
$Velocidad = $Distancia / $Tiempo;
$Velocidad = $Velocidad * 3.6;
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;
?>
- Output for 5.6.28, 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- 0.22868572582562
- Output for 7.3.32 - 7.3.33, 8.0.13
- -0.25051602794169
- Output for 7.0.6
- 4.3294894433084E-5
- Output for 7.0.5
- 7.4477818881345E-5
- Output for 7.0.4
- 0.00011469428938451
- Output for 7.0.3
- 9.6727639350103E-5
- Output for 7.0.2
- 8.9346235799197E-5
- Output for 7.0.1
- 8.7577385200917E-5
- Output for 7.0.0
- 8.313984350595E-5
- Output for 5.6.21
- 5.1796137312657E-5
- Output for 5.6.20
- 6.7458165460405E-5
- Output for 5.6.19
- 0.00012217751210638
- Output for 5.6.18
- 0.00010346153509697
- Output for 5.6.17
- 9.4645154452754E-5
- Output for 5.6.16
- 8.1729276974035E-5
- Output for 5.6.15
- 8.0365100513449E-5
- Output for 5.6.14
- 6.3681936654884E-5
- Output for 5.6.13
- 6.28551005872E-5
- Output for 5.6.12
- 5.9404522256043E-5
- Output for 5.6.11
- 5.6527514880483E-5
- Output for 5.6.10
- 5.5838567519986E-5
- Output for 5.6.9
- 5.4477860209263E-5
- Output for 5.6.8
- 5.311210855791E-5
- Output for 5.5.35
- 4.2721501986088E-5
- Output for 5.5.34
- 6.6473962752692E-5
- Output for 5.5.33
- 0.00011888605365614
- Output for 5.5.32
- 9.9005254988793E-5
- Output for 5.5.31
- 9.2652184144188E-5
- Output for 5.5.30
- 7.6564259241425E-5
- Output for 5.5.29
- 6.1616239365365E-5
- Output for 5.5.28
- 5.8608427894647E-5
- Output for 5.5.27
- 5.7882210858126E-5
- Output for 5.5.26
- 5.515073716492E-5
- Output for 5.5.25
- 5.3774810686356E-5
- Output for 5.5.24
- 4.2248986248214E-5
preferences:
155.18 ms | 401 KiB | 199 Q