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) { //xdebug_debug_zval('a', 'b', 'c'); 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"); //error_log($str); preg_match('/^Argument (\\d+) /', $str, $m); $i = $m[1]-1; $a = "$i"; $bt = debug_backtrace(null, 2); $bt1 = $bt[1]['args']; //xdebug_debug_zval("bt1"); //print_r($bt); $a = "$a {$bt[1]['args'][$i]}"; $bt[1]['args'][$i] = add1($bt[1]['args'][$i]); $bt1 = $bt[1]['args']; //xdebug_debug_zval("bt1"); $a = "$a {$bt[1]['args'][$i]}"; if (false && $i == 1) { $a = "$a ({$bt[1]['args'][1+$i]}"; ++$bt[1]['args'][1+$i]; $a = "$a {$bt[1]['args'][1+$i]})"; } error_log($a); //$zval = $bt[1]['args'][1]; //$bt[1]['args'][1] = add1($bt[1]['args'][1]); //print_r($bt); 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/i3D7u
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'changeF'
          2        SEND_VAL                                                 32767
          3        DO_ICALL                                                 
   48     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/i3D7u
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/i3D7u
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
    9     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                                                 
   10    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                                                 
   11    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/i3D7u
function name:  add1
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        PRE_INC                                          ~1      !0
          2      > RETURN                                                   ~1
   15     3*     > RETURN                                                   null

End of function add1

Function changef:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 73
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 73
filename:       /in/i3D7u
function name:  changeF
number of ops:  78
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
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'error_log'
          3        SEND_VAL                                                 'in+changeF'
          4        DO_ICALL                                                 
   20     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                                                 
   21    10        FETCH_DIM_R                                      ~9      !2, 1
         11        SUB                                              ~10     ~9, 1
         12        ASSIGN                                                   !3, ~10
   22    13        CAST                                          6  ~12     !3
         14        ASSIGN                                                   !4, ~12
   23    15        INIT_FCALL                                               'debug_backtrace'
         16        SEND_VAL                                                 null
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !5, $14
   24    20        FETCH_DIM_R                                      ~16     !5, 1
         21        FETCH_DIM_R                                      ~17     ~16, 'args'
         22        ASSIGN                                                   !6, ~17
   27    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
   28    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
   29    40        FETCH_DIM_R                                      ~33     !5, 1
         41        FETCH_DIM_R                                      ~34     ~33, 'args'
         42        ASSIGN                                                   !6, ~34
   31    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
   32    50      > JMPZ                                                     <false>, ->73
   33    51    >   ROPE_INIT                                     3  ~48     !4
         52        ROPE_ADD                                      1  ~48     ~48, '+%28'
         53        ADD                                              ~45     1, !3
         54        FETCH_DIM_R                                      ~43     !5, 1
         55        FETCH_DIM_R                                      ~44     ~43, 'args'
         56        FETCH_DIM_R                                      ~46     ~44, ~45
         57        ROPE_END                                      2  ~47     ~48, ~46
         58        ASSIGN                                                   !4, ~47
   34    59        ADD                                              ~53     1, !3
         60        FETCH_DIM_RW                                     $51     !5, 1
         61        FETCH_DIM_RW                                     $52     $51, 'args'
         62        FETCH_DIM_RW                                     $54     $52, ~53
         63        PRE_INC                                                  $54
   35    64        ROPE_INIT                                     4  ~61     !4
         65        ROPE_ADD                                      1  ~61     ~61, '+'
         66        ADD                                              ~58     1, !3
         67        FETCH_DIM_R                                      ~56     !5, 1
         68        FETCH_DIM_R                                      ~57     ~56, 'args'
         69        FETCH_DIM_R                                      ~59     ~57, ~58
         70        ROPE_ADD                                      2  ~61     ~61, ~59
         71        ROPE_END                                      3  ~60     ~61, '%29'
         72        ASSIGN                                                   !4, ~60
   37    73    >   INIT_FCALL                                               'error_log'
         74        SEND_VAR                                                 !4
         75        DO_ICALL                                                 
   41    76      > RETURN                                                   <true>
   42    77*     > RETURN                                                   null

End of function changef

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.8 ms | 1407 KiB | 25 Q