3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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";
based on Bj2Er
Output for 5.3.18 - 5.6.28, 7.0.1 - 7.2.0
Should be REFLECTED and is REFLECTED Should be REFLECTED and is REFLECTED Should be REFLECTED and is REFLECTED Should be REFLECTED and is REFLECTED
Output for 7.0.0
Should be REFLECTED and is REFLECTED Should be REFLECTED and is BASE Should be REFLECTED and is REFLECTED Should be REFLECTED and is BASE