3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait foo { protected $foo; protected function foo() { return $this->foo; } } trait bar { use foo; public function bar() { return $this->foo().'bar'; } } class A { use foo; public function __construct() { $this->foo = 'foo'; } } class B extends A { use bar; } $b = new B(); $b->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1qkE
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                            'bar'
   23     1        DECLARE_CLASS                                            'a'
   33     2        DECLARE_CLASS                                            'b', 'a'
   38     3        NEW                                              $1      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   39     6        INIT_METHOD_CALL                                         !0, 'bar'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

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

End of function foo

End of class foo.

Class bar:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1qkE
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_METHOD_CALL                                         'foo'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      $0, 'bar'
          3      > RETURN                                                   ~1
   20     4*     > RETURN                                                   null

End of function bar

End of class bar.

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

End of function __construct

End of class A.

Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.09 ms | 1386 KiB | 13 Q