3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait foo { static $bar = []; public function a() { static::$bar = ["foo"]; echo "Goodbye Moon"; } } class bing { use foo; public function a() { foo::a(); var_dump(self::$bar, foo::$bar); } public function b() { foo::a(); self::$bar[] = "bat"; var_dump(self::$bar, foo::$bar); } } $bing = new bing; $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/piUFm on line 16 Fatal error: Uncaught Error: Non-static method foo::a() cannot be called statically in /in/piUFm:16 Stack trace: #0 /in/piUFm(28): bing->a() #1 {main} thrown in /in/piUFm on line 16
Process exited with code 255.

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:
48.73 ms | 401 KiB | 8 Q