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'; } $r = new ReflectionClass('C'); var_dump($r->getParentClass()->hasMethod('implements'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iHndu
function name:  (null)
number of ops:  16
compiled vars:  !0 = $r
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                                              $1      'ReflectionClass'
          4        SEND_VAL_EX                                              'C'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   49     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'getParentClass'
          9        DO_FCALL                                      0  $4      
         10        INIT_METHOD_CALL                                         $4, 'hasMethod'
         11        SEND_VAL_EX                                              'implements'
         12        DO_FCALL                                      0  $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                                 
         15      > 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/iHndu
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/iHndu
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/iHndu
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:
164.96 ms | 1400 KiB | 15 Q