3v4l.org

run code in 500+ PHP versions simultaneously
<?php function userland_func_num_args() { return count(debug_backtrace()[1]['args']); } function foo() { return func_num_args(); } function bar() { return userland_func_num_args(); } var_dump(foo('foo', 'bar')); var_dump(bar('foo', 'bar'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cg8i0
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL                                                   'foo'
          2        SEND_VAL                                                     'foo'
          3        SEND_VAL                                                     'bar'
          4        DO_FCALL                                          0  $0      
          5        SEND_VAR                                                     $0
          6        DO_ICALL                                                     
    9     7        INIT_FCALL                                                   'var_dump'
          8        INIT_FCALL                                                   'bar'
          9        SEND_VAL                                                     'foo'
         10        SEND_VAL                                                     'bar'
         11        DO_FCALL                                          0  $2      
         12        SEND_VAR                                                     $2
         13        DO_ICALL                                                     
         14      > RETURN                                                       1

Function userland_func_num_args:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cg8i0
function name:  userland_func_num_args
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'debug_backtrace'
          1        DO_ICALL                                             $0      
          2        FETCH_DIM_R                                          ~1      $0, 1
          3        FETCH_DIM_R                                          ~2      ~1, 'args'
          4        COUNT                                                ~3      ~2
          5      > RETURN                                                       ~3
          6*     > RETURN                                                       null

End of function userland_func_num_args

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cg8i0
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   FUNC_NUM_ARGS                                        ~0      
          1      > RETURN                                                       ~0
          2*     > RETURN                                                       null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cg8i0
function name:  bar
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                                   'userland_func_num_args'
          1        DO_FCALL                                          0  $0      
          2      > RETURN                                                       $0
          3*     > RETURN                                                       null

End of function bar

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.42 ms | 3032 KiB | 18 Q