3v4l.org

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

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j53It
function name:  f
number of ops:  20
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
    4     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                                                 
    5    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                                                 
    6    19      > RETURN                                                   null

End of function f

Function changef:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/j53It
function name:  changeF
number of ops:  24
compiled vars:  !0 = $code, !1 = $str, !2 = $m, !3 = $i, !4 = $bt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5EArgument+%28%5Cd%2B%29+%2F'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   10     7        FETCH_DIM_R                                      ~6      !2, 1
          8        SUB                                              ~7      ~6, 1
          9        ASSIGN                                                   !3, ~7
   11    10        INIT_FCALL                                               'debug_backtrace'
         11        SEND_VAL                                                 null
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !4, $9
   12    15        IS_SMALLER                                               0, !3
         16      > JMPZ                                                     ~11, ->22
   13    17    >   SUB                                              ~14     !3, 1
         18        FETCH_DIM_RW                                     $12     !4, 1
         19        FETCH_DIM_RW                                     $13     $12, 'args'
         20        FETCH_DIM_RW                                     $15     $13, ~14
         21        PRE_INC                                                  $15
   15    22    > > RETURN                                                   <true>
   16    23*     > RETURN                                                   null

End of function changef

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.71 ms | 1403 KiB | 24 Q