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 floatval(7.6734156326455E-5); ?>
based on nnSUh
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/3GS4f
function name:  (null)
number of ops:  27
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'
   5     1        NOP                                                      
  10     2        NOP                                                      
  15     3        NOP                                                      
  26     4        INIT_FCALL                                               'calculartiempo'
         5        SEND_VAR                                                 !0
         6        DO_FCALL                                      0  $5      
         7        ASSIGN                                                   !1, $5
  27     8        INIT_FCALL                                               'calculardistancia'
         9        SEND_VAL                                                 38.2781
        10        SEND_VAL                                                 -0.691185
        11        SEND_VAL                                                 38.2788
        12        SEND_VAL                                                 -0.690198
        13        DO_FCALL                                      0  $7      
        14        ASSIGN                                                   !2, $7
  28    15        INIT_FCALL                                               'calcularvelocidad'
        16        SEND_VAR                                                 !2
        17        SEND_VAR                                                 !1
        18        DO_FCALL                                      0  $9      
        19        ASSIGN                                                   !3, $9
  30    20        ECHO                                                     !3
  31    21        ECHO                                                     '%5Cn'
  32    22        INIT_FCALL                                               'floatval'
        23        SEND_VAL                                                 7.67342e-5
        24        DO_ICALL                                         $11     
        25        ECHO                                                     $11
        26      > RETURN                                                   1

Function calculartiempo:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/3GS4f
function name:  CalcularTiempo
number of ops:  14
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        INIT_FCALL                                               'intval'
        10        SEND_VAR                                                 !1
        11        DO_ICALL                                         $6      
        12      > RETURN                                                   $6
   8    13*     > RETURN                                                   null

End of function calculartiempo

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

End of function calcularvelocidad

Function calculardistancia:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/3GS4f
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
-------------------------------------------------------------------------------------
  15     0  E >   RECV                                             !0      
         1        RECV                                             !1      
         2        RECV                                             !2      
         3        RECV                                             !3      
  16     4        ASSIGN                                                   !4, 6371
  17     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
  18    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
  20    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     ~33, $35
        46        INIT_FCALL                                               'sin'
        47        DIV                                              ~37     !6, 2
        48        SEND_VAL                                                 ~37
        49        DO_ICALL                                         $38     
        50        MUL                                              ~39     ~36, $38
        51        ADD                                              ~40     ~24, ~39
        52        ASSIGN                                                   !7, ~40
  21    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     2, $45
        65        ASSIGN                                                   !8, ~46
  23    66        MUL                                              ~48     !4, !8
        67        MUL                                              ~49     ~48, 1000
        68      > RETURN                                                   ~49
  24    69*     > RETURN                                                   null

End of function calculardistancia

Generated using Vulcan Logic Dumper, using php 7.3.0