3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g($a, $b, $c) { f($a, $b, $c); } function f(int $a, int $b = null, int $c = null) { error_log(json_encode([$a, $b, $c])); error_log(json_encode(func_get_args())); } function add1($x) { return ++$x; } function changeF($code, $str) { error_log("in changeF"); preg_match('/^Argument (\\d+) /', $str, $m); $i = $m[1]-1; $a = "$i"; $bt = debug_backtrace(null, 2); $bt1 = $bt[1]['args']; $a = "$a {$bt[1]['args'][$i]}"; $bt[1]['args'][$i] = add1($bt[1]['args'][$i]); $bt1 = $bt[1]['args']; $a = "$a {$bt[1]['args'][$i]}"; error_log($a); return true; } set_error_handler('changeF', E_ALL); //f(2, 1); g(3, 2, 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eh7AA
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'changeF'
          2        SEND_VAL                                                 32767
          3        DO_ICALL                                                 
   35     4        INIT_FCALL                                               'g'
          5        SEND_VAL                                                 3
          6        SEND_VAL                                                 2
          7        SEND_VAL                                                 1
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function g:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eh7AA
function name:  g
number of ops:  9
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        INIT_FCALL_BY_NAME                                       'f'
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !1
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0          
    5     8      > RETURN                                                   null

End of function g

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eh7AA
function name:  f
number of ops:  20
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
    8     3        INIT_FCALL                                               'error_log'
          4        INIT_FCALL                                               'json_encode'
          5        INIT_ARRAY                                       ~3      !0
          6        ADD_ARRAY_ELEMENT                                ~3      !1
          7        ADD_ARRAY_ELEMENT                                ~3      !2
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
    9    12        INIT_FCALL                                               'error_log'
         13        INIT_FCALL                                               'json_encode'
         14        FUNC_GET_ARGS                                    ~6      
         15        SEND_VAL                                                 ~6
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
   10    19      > RETURN                                                   null

End of function f

Function add1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eh7AA
function name:  add1
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        PRE_INC                                          ~1      !0
          2      > RETURN                                                   ~1
   14     3*     > RETURN                                                   null

End of function add1

Function changef:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eh7AA
function name:  changeF
number of ops:  55
compiled vars:  !0 = $code, !1 = $str, !2 = $m, !3 = $i, !4 = $a, !5 = $bt, !6 = $bt1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_FCALL                                               'error_log'
          3        SEND_VAL                                                 'in+changeF'
          4        DO_ICALL                                                 
   18     5        INIT_FCALL                                               'preg_match'
          6        SEND_VAL                                                 '%2F%5EArgument+%28%5Cd%2B%29+%2F'
          7        SEND_VAR                                                 !1
          8        SEND_REF                                                 !2
          9        DO_ICALL                                                 
   19    10        FETCH_DIM_R                                      ~9      !2, 1
         11        SUB                                              ~10     ~9, 1
         12        ASSIGN                                                   !3, ~10
   20    13        CAST                                          6  ~12     !3
         14        ASSIGN                                                   !4, ~12
   21    15        INIT_FCALL                                               'debug_backtrace'
         16        SEND_VAL                                                 null
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !5, $14
   22    20        FETCH_DIM_R                                      ~16     !5, 1
         21        FETCH_DIM_R                                      ~17     ~16, 'args'
         22        ASSIGN                                                   !6, ~17
   23    23        ROPE_INIT                                     3  ~23     !4
         24        ROPE_ADD                                      1  ~23     ~23, '+'
         25        FETCH_DIM_R                                      ~19     !5, 1
         26        FETCH_DIM_R                                      ~20     ~19, 'args'
         27        FETCH_DIM_R                                      ~21     ~20, !3
         28        ROPE_END                                      2  ~22     ~23, ~21
         29        ASSIGN                                                   !4, ~22
   24    30        INIT_FCALL                                               'add1'
         31        FETCH_DIM_R                                      ~29     !5, 1
         32        FETCH_DIM_R                                      ~30     ~29, 'args'
         33        FETCH_DIM_R                                      ~31     ~30, !3
         34        SEND_VAL                                                 ~31
         35        DO_FCALL                                      0  $32     
         36        FETCH_DIM_W                                      $26     !5, 1
         37        FETCH_DIM_W                                      $27     $26, 'args'
         38        ASSIGN_DIM                                               $27, !3
         39        OP_DATA                                                  $32
   25    40        FETCH_DIM_R                                      ~33     !5, 1
         41        FETCH_DIM_R                                      ~34     ~33, 'args'
         42        ASSIGN                                                   !6, ~34
   26    43        ROPE_INIT                                     3  ~40     !4
         44        ROPE_ADD                                      1  ~40     ~40, '+'
         45        FETCH_DIM_R                                      ~36     !5, 1
         46        FETCH_DIM_R                                      ~37     ~36, 'args'
         47        FETCH_DIM_R                                      ~38     ~37, !3
         48        ROPE_END                                      2  ~39     ~40, ~38
         49        ASSIGN                                                   !4, ~39
   27    50        INIT_FCALL                                               'error_log'
         51        SEND_VAR                                                 !4
         52        DO_ICALL                                                 
   28    53      > RETURN                                                   <true>
   29    54*     > RETURN                                                   null

End of function changef

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.41 ms | 1398 KiB | 25 Q