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('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/f4LNZ
function name:  (null)
number of ops:  23
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_VAL_EX                                              'baz'
         15        DO_FCALL                                      0          
   11    16        INIT_METHOD_CALL                                         !1, 'setAccessible'
         17        SEND_VAL_EX                                              <false>
         18        DO_FCALL                                      0          
   12    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.99 ms | 1399 KiB | 15 Q