3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface A { public function foo(); } class B implements A { public function foo() { echo "foo"; } public function bar() { echo "bar"; } } class C { public function __construct(protected A $prop) { $this->prop->foo(); } } class D extends C { public function __construct(B $prop) {// Remove "protected" so that this is just an argument, not a property // Call the parent so that the field has a value parent::__construct($prop); $this->prop->bar(); } } $b = new B(); $d = new D($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNdKY
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b, !1 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                            'b'
   31     1        NEW                                              $2      'B'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   32     4        NEW                                              $5      'D'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
          8      > RETURN                                                   1

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

End of function foo

End of class A.

Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNdKY
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'foo'
   10     1      > 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/iNdKY
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'bar'
   14     1      > RETURN                                                   null

End of function bar

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNdKY
function name:  __construct
number of ops:  7
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'prop'
          2        OP_DATA                                                  !0
   19     3        FETCH_OBJ_R                                      ~1      'prop'
          4        INIT_METHOD_CALL                                         ~1, 'foo'
          5        DO_FCALL                                      0          
   20     6      > RETURN                                                   null

End of function __construct

End of class C.

Class D:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNdKY
function name:  __construct
number of ops:  8
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   27     4        FETCH_OBJ_R                                      ~2      'prop'
          5        INIT_METHOD_CALL                                         ~2, 'bar'
          6        DO_FCALL                                      0          
   28     7      > RETURN                                                   null

End of function __construct

End of class D.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.37 ms | 1002 KiB | 13 Q