3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { public readonly string $full; public function __construct( public readonly string $first, public readonly string $last, ) { unset($this->full); } public function __get(string $key) { print __FUNCTION__ . PHP_EOL; if ($key === 'full') { $this->full = "$this->first $this->last"; return $this->full; } } } $c = new C('Larry', 'Garfield'); print $c->first . PHP_EOL; print $c->full . PHP_EOL; print $c->full . PHP_EOL;
Output for git.master, git.master_jit
Larry __get Larry Garfield Larry Garfield

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:
80.38 ms | 1009 KiB | 4 Q