3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait foo { static $bar = []; public static function a() { static::$bar = ["foo"]; echo "Goodbye Moon"; } } class bing { use foo; public static function a() { foo::a(); var_dump(self::$bar, foo::$bar); } public static function b() { foo::a(); self::$bar[] = "bat"; var_dump(self::$bar, foo::$bar); } } bing::a(); bing::b();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Calling static trait method foo::a is deprecated, it should only be called on a class using the trait in /in/UZ6gq on line 16 Deprecated: Accessing static trait property foo::$bar is deprecated, it should only be accessed on a class using the trait in /in/UZ6gq on line 6 Goodbye Moon Deprecated: Accessing static trait property foo::$bar is deprecated, it should only be accessed on a class using the trait in /in/UZ6gq on line 17 array(0) { } array(1) { [0]=> string(3) "foo" } Deprecated: Calling static trait method foo::a is deprecated, it should only be called on a class using the trait in /in/UZ6gq on line 21 Deprecated: Accessing static trait property foo::$bar is deprecated, it should only be accessed on a class using the trait in /in/UZ6gq on line 6 Goodbye Moon Deprecated: Accessing static trait property foo::$bar is deprecated, it should only be accessed on a class using the trait in /in/UZ6gq on line 23 array(1) { [0]=> string(3) "bat" } array(1) { [0]=> string(3) "foo" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
125.46 ms | 408 KiB | 5 Q