3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Test { private $bridge; public function implement() { if (!isset($this->final)){ parent::implement(); } echo $this->foo; } } class A { use Test; private $foo = 'bar'; private $final = 1; public function __construct() { $this->implement(); } public function foo() { echo $this->bridge; } } class B extends A { use Test; private $foo = 'foo'; } class C extends B { use Test; private $foo = 'buz'; } new C();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HdKoF
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'a'
   35     1        DECLARE_CLASS                                            'b', 'a'
   41     2        DECLARE_CLASS                                            'c', 'b'
   47     3        NEW                                              $0      'C'
          4        DO_FCALL                                      0          
          5        FREE                                                     $0
          6      > RETURN                                                   1

Class Test:
Function implement:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/HdKoF
function name:  implement
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ISSET_ISEMPTY_PROP_OBJ                           ~0      'final'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->5
   10     3    >   INIT_STATIC_METHOD_CALL                                  'implement'
          4        DO_FCALL                                      0          
   13     5    >   FETCH_OBJ_R                                      ~3      'foo'
          6        ECHO                                                     ~3
   14     7      > RETURN                                                   null

End of function implement

End of class Test.

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

End of function __construct

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

End of function foo

End of class A.

Class B: [no user functions]
Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
205.68 ms | 1395 KiB | 13 Q