3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct() { switch (func_num_args()) { case 2: var_dump(func_get_arg(0)); var_dump(func_get_arg(1)); break; case 4: var_dump(func_get_arg(0)); var_dump(func_get_arg(1)); var_dump(func_get_arg(2)); var_dump(func_get_arg(3)); break; default: throw new Exception('Wrong number of arguments'); break; } } } new Foo('foo', 'bar'); new Foo('foo', 'bar', 'baz', 'qux'); new Foo('foo', 'bar', 'baz');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SBkN2
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $0      'Foo'
          1        SEND_VAL_EX                                              'foo'
          2        SEND_VAL_EX                                              'bar'
          3        DO_FCALL                                      0          
          4        FREE                                                     $0
   24     5        NEW                                              $2      'Foo'
          6        SEND_VAL_EX                                              'foo'
          7        SEND_VAL_EX                                              'bar'
          8        SEND_VAL_EX                                              'baz'
          9        SEND_VAL_EX                                              'qux'
         10        DO_FCALL                                      0          
         11        FREE                                                     $2
   25    12        NEW                                              $4      'Foo'
         13        SEND_VAL_EX                                              'foo'
         14        SEND_VAL_EX                                              'bar'
         15        SEND_VAL_EX                                              'baz'
         16        DO_FCALL                                      0          
         17        FREE                                                     $4
         18      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
filename:       /in/SBkN2
function name:  __construct
number of ops:  51
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FUNC_NUM_ARGS                                    ~0      
    6     1        CASE                                                     ~0, 2
          2      > JMPNZ                                                    ~1, ->6
   10     3    >   CASE                                                     ~0, 4
          4      > JMPNZ                                                    ~1, ->19
          5    > > JMP                                                      ->44
    7     6    >   INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'func_get_arg'
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
    8    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'func_get_arg'
         14        SEND_VAL                                                 1
         15        DO_ICALL                                         $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
    9    18      > JMP                                                      ->49
   11    19    >   INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'func_get_arg'
         21        SEND_VAL                                                 0
         22        DO_ICALL                                         $6      
         23        SEND_VAR                                                 $6
         24        DO_ICALL                                                 
   12    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'func_get_arg'
         27        SEND_VAL                                                 1
         28        DO_ICALL                                         $8      
         29        SEND_VAR                                                 $8
         30        DO_ICALL                                                 
   13    31        INIT_FCALL                                               'var_dump'
         32        INIT_FCALL                                               'func_get_arg'
         33        SEND_VAL                                                 2
         34        DO_ICALL                                         $10     
         35        SEND_VAR                                                 $10
         36        DO_ICALL                                                 
   14    37        INIT_FCALL                                               'var_dump'
         38        INIT_FCALL                                               'func_get_arg'
         39        SEND_VAL                                                 3
         40        DO_ICALL                                         $12     
         41        SEND_VAR                                                 $12
         42        DO_ICALL                                                 
   15    43      > JMP                                                      ->49
   17    44    >   NEW                                              $14     'Exception'
         45        SEND_VAL_EX                                              'Wrong+number+of+arguments'
         46        DO_FCALL                                      0          
         47      > THROW                                         0          $14
   18    48*       JMP                                                      ->49
         49    >   FREE                                                     ~0
   20    50      > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.37 ms | 1400 KiB | 17 Q