3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait foo { static $bar = []; public static function a() { static::$bar = ["foo"]; echo "Goodbye Moon"; } } class bing { use foo; static $bar = []; public static function a() { foo::a(); var_dump(static::$bar, foo::$bar); } } bing::a();
based on FcV8Q
Output for 7.0.0 - 7.2.0
Goodbye Moonarray(0) { } array(1) { [0]=> string(3) "foo" }
Output for 5.6.7 - 5.6.28
Strict Standards: bing and foo define the same property ($bar) in the composition of bing. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /in/GiNC8 on line 20 Goodbye Moonarray(0) { } array(1) { [0]=> string(3) "foo" }
Output for 5.4.2 - 5.5.35
Fatal error: bing and foo define the same property ($bar) in the composition of bing. However, the definition differs and is considered incompatible. Class was composed in /in/GiNC8 on line 20
Process exited with code 255.
Output for 5.3.17 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/GiNC8 on line 2
Process exited with code 255.