3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $var = true; } class Bar extends Foo { public $var = 'abc'; } $reflectionFoo = new ReflectionProperty('Foo', 'var'); $reflectionBar = new ReflectionProperty('Bar', 'var'); Reflection::export($reflectionFoo); Reflection::export($reflectionBar); $bar = new Bar(); var_dump($bar); $reflectionFoo->setAccessible(true); $reflectionFoo->setValue($bar, '<NEW>'); var_dump($bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BFPv7
function name:  (null)
number of ops:  33
compiled vars:  !0 = $reflectionFoo, !1 = $reflectionBar, !2 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $3      'ReflectionProperty'
          1        SEND_VAL_EX                                              'Foo'
          2        SEND_VAL_EX                                              'var'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   15     5        NEW                                              $6      'ReflectionProperty'
          6        SEND_VAL_EX                                              'Bar'
          7        SEND_VAL_EX                                              'var'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   17    10        INIT_STATIC_METHOD_CALL                                  'Reflection', 'export'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
   18    13        INIT_STATIC_METHOD_CALL                                  'Reflection', 'export'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
   20    16        NEW                                              $11     'Bar'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !2, $11
   22    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
   24    22        INIT_METHOD_CALL                                         !0, 'setAccessible'
         23        SEND_VAL_EX                                              <true>
         24        DO_FCALL                                      0          
   25    25        INIT_METHOD_CALL                                         !0, 'setValue'
         26        SEND_VAR_EX                                              !2
         27        SEND_VAL_EX                                              '%3CNEW%3E'
         28        DO_FCALL                                      0          
   27    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Class Foo: [no user functions]
Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.14 ms | 1400 KiB | 15 Q