3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait foo { protected $foo; protected function foo() { return $this->foo; } } trait bar { use foo; protected function bar() { return $this->foo().'bar'; } } class A { use foo; public function __construct($foo) { $this->foo = $foo; } } class B extends A { use bar; } $b = new B('foo'); $b->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T1CSG
function name:  (null)
number of ops:  10
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        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   39     7        INIT_METHOD_CALL                                         !0, 'bar'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class foo:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T1CSG
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/T1CSG
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/T1CSG
function name:  __construct
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   29     1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
   30     3      > 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:
149.27 ms | 1386 KiB | 13 Q