3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait t { function f() { //do stuff } } class a { function f() { // do stuff } } class c extends a { use t; } $class = new ReflectionClass('c'); foreach ($class->getMethods() as $method) { try { printf('method %s::%s%s', $method->class, $method->name, PHP_EOL); $prototype = $method->getPrototype(); printf('prototype %s::%s%s', $prototype->class, $prototype->name, PHP_EOL); } catch (\ReflectionException $e) { printf('%s%s', $e->getMessage(), PHP_EOL); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 38
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 38
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Found catch point at position: 29
Branch analysis from position: 29
2 jumps found. (Code = 107) Position 1 = 30, Position 2 = -2
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
filename:       /in/EGPiQ
function name:  (null)
number of ops:  40
compiled vars:  !0 = $class, !1 = $method, !2 = $prototype, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'c', 'a'
   22     1        NEW                                              $4      'ReflectionClass'
          2        SEND_VAL_EX                                              'c'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   24     5        INIT_METHOD_CALL                                         !0, 'getMethods'
          6        DO_FCALL                                      0  $7      
          7      > FE_RESET_R                                       $8      $7, ->38
          8    > > FE_FETCH_R                                               $8, !1, ->38
   27     9    >   INIT_FCALL                                               'printf'
         10        SEND_VAL                                                 'method+%25s%3A%3A%25s%25s'
         11        FETCH_OBJ_R                                      ~9      !1, 'class'
         12        SEND_VAL                                                 ~9
         13        FETCH_OBJ_R                                      ~10     !1, 'name'
         14        SEND_VAL                                                 ~10
         15        SEND_VAL                                                 '%0A'
         16        DO_ICALL                                                 
   28    17        INIT_METHOD_CALL                                         !1, 'getPrototype'
         18        DO_FCALL                                      0  $12     
         19        ASSIGN                                                   !2, $12
   29    20        INIT_FCALL                                               'printf'
         21        SEND_VAL                                                 'prototype+%25s%3A%3A%25s%25s'
         22        FETCH_OBJ_R                                      ~14     !2, 'class'
         23        SEND_VAL                                                 ~14
         24        FETCH_OBJ_R                                      ~15     !2, 'name'
         25        SEND_VAL                                                 ~15
         26        SEND_VAL                                                 '%0A'
         27        DO_ICALL                                                 
         28      > JMP                                                      ->37
   30    29  E > > CATCH                                       last         'ReflectionException'
   31    30    >   INIT_FCALL                                               'printf'
         31        SEND_VAL                                                 '%25s%25s'
         32        INIT_METHOD_CALL                                         !3, 'getMessage'
         33        DO_FCALL                                      0  $17     
         34        SEND_VAR                                                 $17
         35        SEND_VAL                                                 '%0A'
         36        DO_ICALL                                                 
   24    37    > > JMP                                                      ->8
         38    >   FE_FREE                                                  $8
   34    39      > RETURN                                                   1

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

End of function f

End of class t.

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

End of function f

End of class a.

Class c: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.68 ms | 1400 KiB | 15 Q