3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $bar = 'foo'; } $foo = new Foo(); $reflection = (new ReflectionObject($foo))->getProperty('bar'); $reflection->setAccessible(true); $reflection->setValue($foo, 'baz'); $reflection->setAccessible(false); var_dump($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8rgah
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $reflection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        NEW                                              $5      'ReflectionObject'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        INIT_METHOD_CALL                                         $5, 'getProperty'
          7        SEND_VAL_EX                                              'bar'
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !1, $7
    9    10        INIT_METHOD_CALL                                         !1, 'setAccessible'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   10    13        INIT_METHOD_CALL                                         !1, 'setValue'
         14        SEND_VAR_EX                                              !0
         15        SEND_VAL_EX                                              'baz'
         16        DO_FCALL                                      0          
   11    17        INIT_METHOD_CALL                                         !1, 'setAccessible'
         18        SEND_VAL_EX                                              <false>
         19        DO_FCALL                                      0          
   12    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.31 ms | 1395 KiB | 15 Q