3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait FooTrait { protected $foo = 'configuration'; abstract protected function bar(); protected function doThing() { return $this->foo; } } class Foo { use FooTrait; protected function bar() { } public function thing() { echo $this->doThing(); } } class Bar extends Foo { protected $foo = 'asdf'; public function thing() { $this->bar(); echo $this->doThing(); } } $foo = new Foo(); $foo->thing(); $bar = new Bar(); $bar->thing();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qcju
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                            'foo'
   18     1        DECLARE_CLASS                                            'bar', 'foo'
   25     2        NEW                                              $2      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   26     5        INIT_METHOD_CALL                                         !0, 'thing'
          6        DO_FCALL                                      0          
   27     7        NEW                                              $6      'Bar'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   28    10        INIT_METHOD_CALL                                         !1, 'thing'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

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

End of function bar

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

End of function dothing

End of class FooTrait.

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

End of function bar

Function thing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qcju
function name:  thing
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_METHOD_CALL                                         'doThing'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   16     3      > RETURN                                                   null

End of function thing

End of class Foo.

Class Bar:
Function thing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qcju
function name:  thing
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_METHOD_CALL                                         'bar'
          1        DO_FCALL                                      0          
   22     2        INIT_METHOD_CALL                                         'doThing'
          3        DO_FCALL                                      0  $1      
          4        ECHO                                                     $1
   23     5      > RETURN                                                   null

End of function thing

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.56 ms | 1399 KiB | 13 Q