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, $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/9tksN
function name:  (null)
number of ops:  31
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        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   19    14        NEW                                              $10     'Bar'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $10
   21    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   23    20        INIT_METHOD_CALL                                         !0, 'setAccessible'
         21        SEND_VAL_EX                                              <true>
         22        DO_FCALL                                      0          
   24    23        INIT_METHOD_CALL                                         !0, 'setValue'
         24        SEND_VAR_EX                                              !2
         25        SEND_VAL_EX                                              '%3CNEW%3E'
         26        DO_FCALL                                      0          
   26    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.13 ms | 1395 KiB | 15 Q