3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public static $prop = 'BASE'; } class Child extends Base { } $excepted = 'REFLECTED'; $property = new ReflectionProperty('Base', 'prop'); $property->setValue($excepted); $actual = Base::$prop; echo "Should be $excepted and is $actual\n"; $actual = Child::$prop; echo "Should be $excepted and is $actual\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PgFcm
function name:  (null)
number of ops:  26
compiled vars:  !0 = $excepted, !1 = $property, !2 = $actual
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 'REFLECTED'
   15     1        NEW                                              $4      'ReflectionProperty'
          2        SEND_VAL_EX                                              'Base'
          3        SEND_VAL_EX                                              'prop'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   16     6        INIT_METHOD_CALL                                         !1, 'setValue'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   18     9        FETCH_STATIC_PROP_R          unknown             ~8      'prop'
         10        ASSIGN                                                   !2, ~8
   19    11        ROPE_INIT                                     5  ~11     'Should+be+'
         12        ROPE_ADD                                      1  ~11     ~11, !0
         13        ROPE_ADD                                      2  ~11     ~11, '+and+is+'
         14        ROPE_ADD                                      3  ~11     ~11, !2
         15        ROPE_END                                      4  ~10     ~11, '%0A'
         16        ECHO                                                     ~10
   21    17        FETCH_STATIC_PROP_R          unknown             ~14     'prop'
         18        ASSIGN                                                   !2, ~14
   22    19        ROPE_INIT                                     5  ~17     'Should+be+'
         20        ROPE_ADD                                      1  ~17     ~17, !0
         21        ROPE_ADD                                      2  ~17     ~17, '+and+is+'
         22        ROPE_ADD                                      3  ~17     ~17, !2
         23        ROPE_END                                      4  ~16     ~17, '%0A'
         24        ECHO                                                     ~16
         25      > RETURN                                                   1

Class Base: [no user functions]
Class Child: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.48 ms | 1394 KiB | 13 Q