3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait MyTrait { public function hello() { echo __CLASS__, "\n"; if (\is_callable(array('parent', __FUNCTION__))) { parent::hello(); } } } class ParentClass { use MyTrait; } class ChildClass extends ParentClass { use MyTrait; } $c = new ChildClass(); $c->hello();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BKhG3
function name:  (null)
number of ops:  8
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'parentclass'
   20     1        DECLARE_CLASS                                            'childclass', 'parentclass'
   25     2        NEW                                              $1      'ChildClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   26     5        INIT_METHOD_CALL                                         !0, 'hello'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class MyTrait:
Function hello:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/BKhG3
function name:  hello
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CLASS_NAME                                 ~0      
          1        ECHO                                                     ~0
          2        ECHO                                                     '%0A'
    9     3        INIT_FCALL                                               'is_callable'
          4        SEND_VAL                                                 <array>
          5        DO_ICALL                                         $1      
          6      > JMPZ                                                     $1, ->9
   10     7    >   INIT_STATIC_METHOD_CALL                                  'hello'
          8        DO_FCALL                                      0          
   12     9    > > RETURN                                                   null

End of function hello

End of class MyTrait.

Class ParentClass: [no user functions]
Class ChildClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.29 ms | 1395 KiB | 15 Q