3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo() { static $bar; if ( !$bar ) { $bar = (object)123; } var_dump($bar->scalar); } foo(); $refl = new ReflectionFunction( 'foo' ); $statics = $refl->getStaticVariables(); $statics['bar']->scalar = 456; foo();
Output for 5.0.0 - 7.1.0
int(123) int(456)
Output for 4.3.2 - 4.4.9
int(123) Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/Aa84b on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
int(123) Fatal error: Cannot instantiate non-existent class: reflectionfunction in /in/Aa84b on line 12