3v4l.org

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

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

End of function dothing

End of class FooTrait.

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

End of function thing

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.07 ms | 1394 KiB | 13 Q