3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct(private Bar $bar, private string $_value = 'foo') {} public string $value { get => $this->_value; set { $this->bar->doSomething($this); $this->_value = $value; } } } class Bar { public function doSomething(Foo $foo): void { $oldValue = $foo->value; } } $foo = new Foo(new Bar()); $foo->value = 'bar';
Output for rfc.property-hooks
Fatal error: Uncaught Error: Must not read from virtual property Foo::$value in /in/6W26c:17 Stack trace: #0 /in/6W26c(9): Bar->doSomething(Object(Foo)) #1 /in/6W26c(22): Foo->$value::set('bar') #2 {main} thrown in /in/6W26c on line 17
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:
137.31 ms | 995 KiB | 7 Q