3v4l.org

run code in 300+ PHP versions simultaneously
<?php function var_types() { $bt = debug_backtrace()[0]; $file = new \SPLFileObject($bt['file']); $file->seek($bt['line'] - 1); $line = $file->current(); $matchs = null; preg_match('/var_types\((.*)\)/', $line, $matchs); $param_names = array_map('trim', explode(",", $matchs[1])); $args = func_get_args(); for ($i = 0; $i < count($args); $i++) { echo $param_names[$i] . ' ' . gettype($args[$i]) . PHP_EOL; } } define('MY_CONSTANT', 1); $string = "STR"; $num = 123.4; var_types(MY_CONSTANT, $string, $num, $_GET, $_SERVER['PHP_SELF']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/522df
function name:  (null)
number of ops:  18
compiled vars:  !0 = $string, !1 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'MY_CONSTANT'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                                 
   19     4        ASSIGN                                                   !0, 'STR'
   20     5        ASSIGN                                                   !1, 123.4
   22     6        INIT_FCALL                                               'var_types'
          7        FETCH_CONSTANT                                   ~5      'MY_CONSTANT'
          8        SEND_VAL                                                 ~5
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        FETCH_R                      global              ~6      '_GET'
         12        SEND_VAL                                                 ~6
         13        FETCH_R                      global              ~7      '_SERVER'
         14        FETCH_DIM_R                                      ~8      ~7, 'PHP_SELF'
         15        SEND_VAL                                                 ~8
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Function var_types:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 38
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 38
Branch analysis from position: 49
Branch analysis from position: 38
filename:       /in/522df
function name:  var_types
number of ops:  50
compiled vars:  !0 = $bt, !1 = $file, !2 = $line, !3 = $matchs, !4 = $param_names, !5 = $args, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $7      
          2        FETCH_DIM_R                                      ~8      $7, 0
          3        ASSIGN                                                   !0, ~8
    5     4        NEW                                              $10     'SPLFileObject'
          5        CHECK_FUNC_ARG                                           
          6        FETCH_DIM_FUNC_ARG                               $11     !0, 'file'
          7        SEND_FUNC_ARG                                            $11
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $10
    6    10        INIT_METHOD_CALL                                         !1, 'seek'
         11        FETCH_DIM_R                                      ~14     !0, 'line'
         12        SUB                                              ~15     ~14, 1
         13        SEND_VAL_EX                                              ~15
         14        DO_FCALL                                      0          
    7    15        INIT_METHOD_CALL                                         !1, 'current'
         16        DO_FCALL                                      0  $17     
         17        ASSIGN                                                   !2, $17
    8    18        ASSIGN                                                   !3, null
    9    19        INIT_FCALL                                               'preg_match'
         20        SEND_VAL                                                 '%2Fvar_types%5C%28%28.%2A%29%5C%29%2F'
         21        SEND_VAR                                                 !2
         22        SEND_REF                                                 !3
         23        DO_ICALL                                                 
   10    24        INIT_FCALL                                               'array_map'
         25        SEND_VAL                                                 'trim'
         26        INIT_FCALL                                               'explode'
         27        SEND_VAL                                                 '%2C'
         28        FETCH_DIM_R                                      ~21     !3, 1
         29        SEND_VAL                                                 ~21
         30        DO_ICALL                                         $22     
         31        SEND_VAR                                                 $22
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !4, $23
   11    34        FUNC_GET_ARGS                                    ~25     
         35        ASSIGN                                                   !5, ~25
   13    36        ASSIGN                                                   !6, 0
         37      > JMP                                                      ->46
   14    38    >   FETCH_DIM_R                                      ~28     !4, !6
         39        CONCAT                                           ~29     ~28, '+'
         40        FETCH_DIM_R                                      ~30     !5, !6
         41        GET_TYPE                                         ~31     ~30
         42        CONCAT                                           ~32     ~29, ~31
         43        CONCAT                                           ~33     ~32, '%0A'
         44        ECHO                                                     ~33
   13    45        PRE_INC                                                  !6
         46    >   COUNT                                            ~35     !5
         47        IS_SMALLER                                               !6, ~35
         48      > JMPNZ                                                    ~36, ->38
   16    49    > > RETURN                                                   null

End of function var_types

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
233.55 ms | 1407 KiB | 24 Q