3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $data = 'some data'; } class Bar { private readonly string $data; public function __construct(string $data) { $this->data = $data; } } $foo = new Foo(); $bar = new Bar('some data'); (fn() => $this->data = 'other data')->call($foo); //(fn() => $this->data = 'other data')->call($bar); $foo2 = (fn() => $this->data)->call($foo); //$bar2 = (fn() => $this->data)->call($bar); echo $foo2; //echo $bar2;
Output for git.master_jit, git.master
other data

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:
46.28 ms | 405 KiB | 5 Q