3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct() { $args = func_get_args(); switch (count($args)) { case 2: call_user_func_array(array($this, 'constr2'), $args); break; case 1: call_user_func_array(array($this, 'constr1'), $args); break; } throw new Exception("invalid number of arguments"); } protected function constr1($a) { print "constr1 called\n"; } protected function constr2($a, $b) { print "constr2 called\n"; } } $a = new Foo(2); $b = new Foo(2, 3); $c = new Foo("a", "b", 3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TKWKE
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $3      'Foo'
          1        SEND_VAL_EX                                              2
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   25     4        NEW                                              $6      'Foo'
          5        SEND_VAL_EX                                              2
          6        SEND_VAL_EX                                              3
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   26     9        NEW                                              $9      'Foo'
         10        SEND_VAL_EX                                              'a'
         11        SEND_VAL_EX                                              'b'
         12        SEND_VAL_EX                                              3
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $9
         15      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
filename:       /in/TKWKE
function name:  __construct
number of ops:  30
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FUNC_GET_ARGS                                    ~1      
          1        ASSIGN                                                   !0, ~1
    6     2        COUNT                                            ~3      !0
    7     3        CASE                                                     ~3, 2
          4      > JMPNZ                                                    ~4, ->8
   10     5    >   CASE                                                     ~3, 1
          6      > JMPNZ                                                    ~4, ->16
          7    > > JMP                                                      ->24
    8     8    >   FETCH_THIS                                       ~5      
          9        INIT_ARRAY                                       ~6      ~5
         10        ADD_ARRAY_ELEMENT                                ~6      'constr2'
         11        INIT_USER_CALL                                0          'call_user_func_array', ~6
         12        SEND_ARRAY                                               !0
         13        CHECK_UNDEF_ARGS                                         
         14        DO_FCALL                                      0          
    9    15      > JMP                                                      ->24
   11    16    >   FETCH_THIS                                       ~8      
         17        INIT_ARRAY                                       ~9      ~8
         18        ADD_ARRAY_ELEMENT                                ~9      'constr1'
         19        INIT_USER_CALL                                0          'call_user_func_array', ~9
         20        SEND_ARRAY                                               !0
         21        CHECK_UNDEF_ARGS                                         
         22        DO_FCALL                                      0          
   12    23      > JMP                                                      ->24
         24    >   FREE                                                     ~3
   14    25        NEW                                              $11     'Exception'
         26        SEND_VAL_EX                                              'invalid+number+of+arguments'
         27        DO_FCALL                                      0          
         28      > THROW                                         0          $11
   15    29*     > RETURN                                                   null

End of function __construct

Function constr1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TKWKE
function name:  constr1
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ECHO                                                     'constr1+called%0A'
   18     2      > RETURN                                                   null

End of function constr1

Function constr2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TKWKE
function name:  constr2
number of ops:  4
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        ECHO                                                     'constr2+called%0A'
   21     3      > RETURN                                                   null

End of function constr2

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.95 ms | 1390 KiB | 13 Q