3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ApiController { /* * * Public methods meant to be exposed... * */ protected function protectedMethod() { echo "This should be protected!"; } public function handle($method) { if (!is_callable(array($this, $method))) { die("Not callable!"); } $refMethod = new ReflectionMethod($this, $method); $refMethod->invoke($this); // No visibility check } } // Simulate a web request $api = new ApiController(); $api->handle('protectedMethod');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IODNa
function name:  (null)
number of ops:  7
compiled vars:  !0 = $api
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $1      'ApiController'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   30     3        INIT_METHOD_CALL                                         !0, 'handle'
          4        SEND_VAL_EX                                              'protectedMethod'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class ApiController:
Function protectedmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IODNa
function name:  protectedMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'This+should+be+protected%21'
   14     1      > RETURN                                                   null

End of function protectedmethod

Function handle:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IODNa
function name:  handle
number of ops:  21
compiled vars:  !0 = $method, !1 = $refMethod
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'is_callable'
          2        FETCH_THIS                                       ~2      
          3        INIT_ARRAY                                       ~3      ~2
          4        ADD_ARRAY_ELEMENT                                ~3      !0
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                         $4      
          7        BOOL_NOT                                         ~5      $4
          8      > JMPZ                                                     ~5, ->10
   20     9    > > EXIT                                                     'Not+callable%21'
   23    10    >   NEW                                              $6      'ReflectionMethod'
         11        FETCH_THIS                                       $7      
         12        SEND_VAR_EX                                              $7
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $6
   24    16        INIT_METHOD_CALL                                         !1, 'invoke'
         17        FETCH_THIS                                       $10     
         18        SEND_VAR_EX                                              $10
         19        DO_FCALL                                      0          
   25    20      > RETURN                                                   null

End of function handle

End of class ApiController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.96 ms | 998 KiB | 14 Q