3v4l.org

run code in 300+ PHP versions simultaneously
<?php class my_private_class { private function my_private_method() { echo 'execute me!'; } } class another_class { public function execute_private_methods($instance) { $instance->my_private_method(); } } $object = new my_private_class(); $reflection = new \ReflectionClass('my_private_class'); $method = $reflection->getMethod('my_private_method'); $method->setAccessible(true); $method->invokeArgs($object);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjYjG
function name:  (null)
number of ops:  18
compiled vars:  !0 = $object, !1 = $reflection, !2 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $3      'my_private_class'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   16     3        NEW                                              $6      'ReflectionClass'
          4        SEND_VAL_EX                                              'my_private_class'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   17     7        INIT_METHOD_CALL                                         !1, 'getMethod'
          8        SEND_VAL_EX                                              'my_private_method'
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !2, $9
   18    11        INIT_METHOD_CALL                                         !2, 'setAccessible'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   19    14        INIT_METHOD_CALL                                         !2, 'invokeArgs'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Class my_private_class:
Function my_private_method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjYjG
function name:  my_private_method
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'execute+me%21'
    6     1      > RETURN                                                   null

End of function my_private_method

End of class my_private_class.

Class another_class:
Function execute_private_methods:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjYjG
function name:  execute_private_methods
number of ops:  4
compiled vars:  !0 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_METHOD_CALL                                         !0, 'my_private_method'
          2        DO_FCALL                                      0          
   12     3      > RETURN                                                   null

End of function execute_private_methods

End of class another_class.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.3 ms | 1395 KiB | 13 Q