3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public function method() { echo "BBB"; } } class A { public function method() { echo "I'not suppose to"; } } class TestParentClass extends A { public function method() { print_r('Parent method'); print "\n"; } } trait TestTrait { public function method() { print_r('Trait method'); print "\n"; } } class TestChildClass extends TestParentClass { use TestTrait { B::method as method; /* TestTrait::method as methodAlias; TestParentClass::method insteadof TestTrait; */ } } //(new TestChildClass)->mth(); (new TestChildClass)->method(); (new TestChildClass)->method(); (new TestChildClass)->methodAlias();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KBulc
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   DECLARE_CLASS                                            'testchildclass', 'testparentclass'
   49     1        NEW                                              $0      'TestChildClass'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'method'
          4        DO_FCALL                                      0          
   50     5        NEW                                              $3      'TestChildClass'
          6        DO_FCALL                                      0          
          7        INIT_METHOD_CALL                                         $3, 'method'
          8        DO_FCALL                                      0          
   51     9        NEW                                              $6      'TestChildClass'
         10        DO_FCALL                                      0          
         11        INIT_METHOD_CALL                                         $6, 'methodAlias'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

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

End of function method

End of class B.

Class A:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KBulc
function name:  method
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                     'I%27not+suppose+to'
   15     1      > RETURN                                                   null

End of function method

End of class A.

Class TestParentClass:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KBulc
function name:  method
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'print_r'
          1        SEND_VAL                                                 'Parent+method'
          2        DO_ICALL                                                 
   23     3        ECHO                                                     '%0A'
   24     4      > RETURN                                                   null

End of function method

End of class TestParentClass.

Class TestTrait:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KBulc
function name:  method
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'print_r'
          1        SEND_VAL                                                 'Trait+method'
          2        DO_ICALL                                                 
   32     3        ECHO                                                     '%0A'
   33     4      > RETURN                                                   null

End of function method

End of class TestTrait.

Class TestChildClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.16 ms | 1400 KiB | 15 Q