3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public static $bar = ['foo' => 1, 'bar' => 2]; public static function baz ($name) { return self::$bar[$name]; } } $item = ['name' => 'bar']; $baz = ['bar' => 'baz']; echo Foo::$bar[$item['name']]; echo Foo::$baz[$item['name']]($item['name']);
based on iViK2
Output for 7.0.0 - 7.3.0rc3
2 Fatal error: Uncaught Error: Access to undeclared static property: Foo::$baz in /in/MDCjA:10 Stack trace: #0 {main} thrown in /in/MDCjA on line 10
Process exited with code 255.
Output for hhvm-3.15.4
2 Fatal error: Uncaught Error: Invalid static property access: Foo::baz in /in/MDCjA:10 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
22