3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $myProperty = true; } $class = new ReflectionClass("MyClass"); $property = $class->getProperty("myProperty"); $property->setAccessible(false); $obj = new MyClass(); echo $property->getValue($obj); // Works //echo $obj->myProperty; // Doesn't work (error)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3PEb
function name:  (null)
number of ops:  19
compiled vars:  !0 = $class, !1 = $property, !2 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'MyClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    8     4        INIT_METHOD_CALL                                         !0, 'getProperty'
          5        SEND_VAL_EX                                              'myProperty'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
    9     8        INIT_METHOD_CALL                                         !1, 'setAccessible'
          9        SEND_VAL_EX                                              <false>
         10        DO_FCALL                                      0          
   11    11        NEW                                              $9      'MyClass'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $9
   12    14        INIT_METHOD_CALL                                         !1, 'getValue'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $12     
         17        ECHO                                                     $12
   13    18      > RETURN                                                   1

Class MyClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.27 ms | 1384 KiB | 13 Q