3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function getMethods() { $class = new ReflectionClass($this); $methods = $class->getMethods(ReflectionMethod::IS_PRIVATE); print_r($methods); } } class Bar extends Foo { public function privateFunction() {} // Not visible for parent::getMethods() } $Bar = new Bar(); $Bar->getMethods();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qBYC5
function name:  (null)
number of ops:  6
compiled vars:  !0 = $Bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'getMethods'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Foo:
Function getmethods:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qBYC5
function name:  getMethods
number of ops:  13
compiled vars:  !0 = $class, !1 = $methods
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'ReflectionClass'
          1        FETCH_THIS                                       $3      
          2        SEND_VAR_EX                                              $3
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
    8     5        INIT_METHOD_CALL                                         !0, 'getMethods'
          6        SEND_VAL_EX                                              4
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !1, $6
    9     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   10    12      > RETURN                                                   null

End of function getmethods

End of class Foo.

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

End of function privatefunction

Function getmethods:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qBYC5
function name:  getMethods
number of ops:  13
compiled vars:  !0 = $class, !1 = $methods
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'ReflectionClass'
          1        FETCH_THIS                                       $3      
          2        SEND_VAR_EX                                              $3
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
    8     5        INIT_METHOD_CALL                                         !0, 'getMethods'
          6        SEND_VAL_EX                                              4
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !1, $6
    9     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   10    12      > RETURN                                                   null

End of function getmethods

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.58 ms | 1400 KiB | 15 Q