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; static $bar = []; public static function a() { foo::a(); var_dump(static::$bar, foo::$bar); } } bing::a();
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/GiNC8 on line 17 Deprecated: Accessing static trait property foo::$bar is deprecated, it should only be accessed on a class using the trait in /in/GiNC8 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/GiNC8 on line 18 array(0) { } 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:
82.93 ms | 402 KiB | 8 Q