3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClassA { /** @classA */ public function methodA() { } } class ClassB extends ClassA { /** @classB */ public function methodA() { } } $refl = new ReflectionClass('ClassB'); $mthB = $refl->getMethod('methodA'); var_dump($mthB->getDocComment()); var_dump($mthB->getDeclaringClass()); $parent = $refl->getParentClass(); $mthA = $parent->getMethod('methodA'); var_dump($mthA->getDocComment());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tJlXR
function name:  (null)
number of ops:  31
compiled vars:  !0 = $refl, !1 = $mthB, !2 = $parent, !3 = $mthA
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $4      'ReflectionClass'
          1        SEND_VAL_EX                                              'ClassB'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   24     4        INIT_METHOD_CALL                                         !0, 'getMethod'
          5        SEND_VAL_EX                                              'methodA'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !1, $7
   25     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !1, 'getDocComment'
         10        DO_FCALL                                      0  $9      
         11        SEND_VAR                                                 $9
         12        DO_ICALL                                                 
   26    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !1, 'getDeclaringClass'
         15        DO_FCALL                                      0  $11     
         16        SEND_VAR                                                 $11
         17        DO_ICALL                                                 
   28    18        INIT_METHOD_CALL                                         !0, 'getParentClass'
         19        DO_FCALL                                      0  $13     
         20        ASSIGN                                                   !2, $13
   29    21        INIT_METHOD_CALL                                         !2, 'getMethod'
         22        SEND_VAL_EX                                              'methodA'
         23        DO_FCALL                                      0  $15     
         24        ASSIGN                                                   !3, $15
   30    25        INIT_FCALL                                               'var_dump'
         26        INIT_METHOD_CALL                                         !3, 'getDocComment'
         27        DO_FCALL                                      0  $17     
         28        SEND_VAR                                                 $17
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

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

End of function methoda

End of class ClassA.

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

End of function methoda

End of class ClassB.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.15 ms | 1396 KiB | 15 Q