3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { use C; public function __construct($foo) { $this->__init($foo); } } class B extends A { public function __construct() { $this->foo = 'bar2'; } } trait C { private $foo; private function __init($foo) { $this->foo = $foo; } } $test = new B('bar'); print_r($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VA6mI
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   11     1        DECLARE_CLASS                                            'b', 'a'
   27     2        NEW                                              $1      'B'
          3        SEND_VAL_EX                                              'bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   29     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VA6mI
function name:  __construct
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_METHOD_CALL                                         '__init'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    8     4      > RETURN                                                   null

End of function __construct

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VA6mI
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN_OBJ                                               'foo'
          1        OP_DATA                                                  'bar2'
   15     2      > RETURN                                                   null

End of function __construct

End of class B.

Class C:
Function __init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VA6mI
function name:  __init
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function __init

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.21 ms | 1396 KiB | 15 Q