3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TestTrait { public function showSelf(): void { echo get_parent_class($this); } } class TestClass { use TestTrait; } class TestSubClass extends TestClass { } $c = new TestSubClass(); $c->showSelf();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XMMcR
function name:  (null)
number of ops:  8
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                            'testclass'
   13     1        DECLARE_CLASS                                            'testsubclass', 'testclass'
   15     2        NEW                                              $1      'TestSubClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   16     5        INIT_METHOD_CALL                                         !0, 'showSelf'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class TestTrait:
Function showself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XMMcR
function name:  showSelf
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'get_parent_class'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4        ECHO                                                     $1
    6     5      > RETURN                                                   null

End of function showself

End of class TestTrait.

Class TestClass: [no user functions]
Class TestSubClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.45 ms | 1015 KiB | 14 Q