3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { static $bar; if ( !$bar ) { $bar = 123; } var_dump($bar); } foo(); $refl = new ReflectionFunction( 'foo' ); $statics = $refl->getStaticVariables(); $statics['bar'] = 456; foo();

preferences:
31.24 ms | 402 KiB | 5 Q