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"; Base::$prop = strrev(strrev(Base::$prop)); // force new zval Base::$prop = $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/sb6Il
function name:  (null)
number of ops:  53
compiled vars:  !0 = $excepted, !1 = $property, !2 = $actual
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 'REFLECTED'
   16     1        NEW                                              $4      'ReflectionProperty'
          2        SEND_VAL_EX                                              'Base'
          3        SEND_VAL_EX                                              'prop'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   17     6        INIT_METHOD_CALL                                         !1, 'setValue'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   19     9        FETCH_STATIC_PROP_R          unknown             ~8      'prop'
         10        ASSIGN                                                   !2, ~8
   20    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
   22    17        FETCH_STATIC_PROP_R          unknown             ~14     'prop'
         18        ASSIGN                                                   !2, ~14
   23    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
   26    25        INIT_FCALL                                               'strrev'
         26        INIT_FCALL                                               'strrev'
         27        FETCH_STATIC_PROP_R          unknown             ~21     'prop'
         28        SEND_VAL                                                 ~21
         29        DO_ICALL                                         $22     
         30        SEND_VAR                                                 $22
         31        DO_ICALL                                         $23     
         32        ASSIGN_STATIC_PROP                                       'prop', 'Base'
         33        OP_DATA                                                  $23
   27    34        ASSIGN_STATIC_PROP                                       'prop', 'Base'
         35        OP_DATA                                                  !0
   29    36        FETCH_STATIC_PROP_R          unknown             ~25     'prop'
         37        ASSIGN                                                   !2, ~25
   30    38        ROPE_INIT                                     5  ~28     'Should+be+'
         39        ROPE_ADD                                      1  ~28     ~28, !0
         40        ROPE_ADD                                      2  ~28     ~28, '+and+is+'
         41        ROPE_ADD                                      3  ~28     ~28, !2
         42        ROPE_END                                      4  ~27     ~28, '%0A'
         43        ECHO                                                     ~27
   32    44        FETCH_STATIC_PROP_R          unknown             ~31     'prop'
         45        ASSIGN                                                   !2, ~31
   33    46        ROPE_INIT                                     5  ~34     'Should+be+'
         47        ROPE_ADD                                      1  ~34     ~34, !0
         48        ROPE_ADD                                      2  ~34     ~34, '+and+is+'
         49        ROPE_ADD                                      3  ~34     ~34, !2
         50        ROPE_END                                      4  ~33     ~34, '%0A'
         51        ECHO                                                     ~33
         52      > RETURN                                                   1

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.98 ms | 1392 KiB | 15 Q