3v4l.org

run code in 300+ PHP versions simultaneously
<?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();

preferences:
36.86 ms | 402 KiB | 5 Q