3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $myProperty = 'yeth'; } $class = new ReflectionClass("MyClass"); $property = $class->getProperty("myProperty"); $property->setAccessible(true); $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/5edQ2
function name:  (null)
number of ops:  21
compiled vars:  !0 = $class, !1 = $property, !2 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'MyClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    7     4        INIT_METHOD_CALL                                         !0, 'getProperty'
          5        SEND_VAL_EX                                              'myProperty'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
    8     8        INIT_METHOD_CALL                                         !1, 'setAccessible'
          9        SEND_VAL_EX                                              <true>
         10        DO_FCALL                                      0          
   10    11        NEW                                              $9      'MyClass'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $9
   11    14        INIT_METHOD_CALL                                         !1, 'getValue'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $12     
         17        ECHO                                                     $12
   12    18        FETCH_OBJ_R                                      ~13     !2, 'myProperty'
         19        ECHO                                                     ~13
   13    20      > RETURN                                                   1

Class MyClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.19 ms | 1394 KiB | 13 Q