3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct( public string &$ref { get => $this->ref ?? 'null'; set => $this->ref = $value; } ) {} } $var = 'hello'; $foo = new Foo($var); $var = "world"; echo $foo->ref;
Output for git.master, git.master_jit
Fatal error: Uncaught Error: Indirect modification of Foo::$ref is not allowed in /in/JRArK:5 Stack trace: #0 /in/JRArK(10): Foo->__construct('hello') #1 {main} Next Error: Cannot assign by reference to overloaded object in /in/JRArK:5 Stack trace: #0 /in/JRArK(10): Foo->__construct('hello') #1 {main} thrown in /in/JRArK on line 5
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:
135.37 ms | 999 KiB | 7 Q