3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Fecha = "2016-01-27 11:50:19"; 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 $Velocidad; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjWET
function name:  (null)
number of ops:  19
compiled vars:  !0 = $Fecha, !1 = $Tiempo, !2 = $Distancia, !3 = $Velocidad
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2016-01-27+11%3A50%3A19'
   25     1        INIT_FCALL                                               'calculartiempo'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $5      
          4        ASSIGN                                                   !1, $5
   26     5        INIT_FCALL                                               'calculardistancia'
          6        SEND_VAL                                                 38.2781
          7        SEND_VAL                                                 -0.691185
          8        SEND_VAL                                                 38.2788
          9        SEND_VAL                                                 -0.690198
         10        DO_FCALL                                      0  $7      
         11        ASSIGN                                                   !2, $7
   27    12        INIT_FCALL                                               'calcularvelocidad'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !1
         15        DO_FCALL                                      0  $9      
         16        ASSIGN                                                   !3, $9
   29    17        ECHO                                                     !3
   31    18      > RETURN                                                   1

Function calculartiempo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjWET
function name:  CalcularTiempo
number of ops:  12
compiled vars:  !0 = $Timestamp, !1 = $Segundos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'strtotime'
          2        SEND_VAL                                                 'now'
          3        DO_ICALL                                         $2      
          4        INIT_FCALL                                               'strtotime'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SUB                                              ~4      $2, $3
          8        ASSIGN                                                   !1, ~4
    7     9        CAST                                          4  ~6      !1
         10      > RETURN                                                   ~6
    8    11*     > RETURN                                                   null

End of function calculartiempo

Function calcularvelocidad:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjWET
function name:  CalcularVelocidad
number of ops:  5
compiled vars:  !0 = $Distancia, !1 = $Tiempo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        DIV                                              ~2      !0, !1
          3      > RETURN                                                   ~2
   12     4*     > RETURN                                                   null

End of function calcularvelocidad

Function calculardistancia:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjWET
function name:  CalcularDistancia
number of ops:  70
compiled vars:  !0 = $OrigenLat, !1 = $OrigenLon, !2 = $DestinoLat, !3 = $DestinoLon, !4 = $R, !5 = $dLat, !6 = $dLon, !7 = $a, !8 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   15     4        ASSIGN                                                   !4, 6371
   16     5        SUB                                              ~10     !2, !0
          6        INIT_FCALL                                               'pi'
          7        DO_ICALL                                         $11     
          8        DIV                                              ~12     $11, 180
          9        MUL                                              ~13     ~10, ~12
         10        ASSIGN                                                   !5, ~13
   17    11        SUB                                              ~15     !3, !1
         12        INIT_FCALL                                               'pi'
         13        DO_ICALL                                         $16     
         14        DIV                                              ~17     $16, 180
         15        MUL                                              ~18     ~15, ~17
         16        ASSIGN                                                   !6, ~18
   19    17        INIT_FCALL                                               'sin'
         18        DIV                                              ~20     !5, 2
         19        SEND_VAL                                                 ~20
         20        DO_ICALL                                         $21     
         21        INIT_FCALL                                               'sin'
         22        DIV                                              ~22     !5, 2
         23        SEND_VAL                                                 ~22
         24        DO_ICALL                                         $23     
         25        MUL                                              ~24     $21, $23
         26        INIT_FCALL                                               'cos'
         27        INIT_FCALL                                               'pi'
         28        DO_ICALL                                         $25     
         29        DIV                                              ~26     $25, 180
         30        MUL                                              ~27     !0, ~26
         31        SEND_VAL                                                 ~27
         32        DO_ICALL                                         $28     
         33        INIT_FCALL                                               'cos'
         34        INIT_FCALL                                               'pi'
         35        DO_ICALL                                         $29     
         36        DIV                                              ~30     $29, 180
         37        MUL                                              ~31     !2, ~30
         38        SEND_VAL                                                 ~31
         39        DO_ICALL                                         $32     
         40        MUL                                              ~33     $28, $32
         41        INIT_FCALL                                               'sin'
         42        DIV                                              ~34     !6, 2
         43        SEND_VAL                                                 ~34
         44        DO_ICALL                                         $35     
         45        MUL                                              ~36     $35, ~33
         46        INIT_FCALL                                               'sin'
         47        DIV                                              ~37     !6, 2
         48        SEND_VAL                                                 ~37
         49        DO_ICALL                                         $38     
         50        MUL                                              ~39     $38, ~36
         51        ADD                                              ~40     ~24, ~39
         52        ASSIGN                                                   !7, ~40
   20    53        INIT_FCALL                                               'atan2'
         54        INIT_FCALL                                               'sqrt'
         55        SEND_VAR                                                 !7
         56        DO_ICALL                                         $42     
         57        SEND_VAR                                                 $42
         58        INIT_FCALL                                               'sqrt'
         59        SUB                                              ~43     1, !7
         60        SEND_VAL                                                 ~43
         61        DO_ICALL                                         $44     
         62        SEND_VAR                                                 $44
         63        DO_ICALL                                         $45     
         64        MUL                                              ~46     $45, 2
         65        ASSIGN                                                   !8, ~46
   22    66        MUL                                              ~48     !4, !8
         67        MUL                                              ~49     ~48, 1000
         68      > RETURN                                                   ~49
   23    69*     > RETURN                                                   null

End of function calculardistancia

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.06 ms | 1398 KiB | 28 Q