3v4l.org

run code in 300+ PHP versions simultaneously
<?php // lint >= 8.1 declare(strict_types = 1); namespace Bug11495; class HelloWorld { private readonly string $foo; public function __construct() { $this->foo = 'bar'; } public function __clone() { $this->foo = 'baz'; $this->foo = 'baz'; } public function getFoo(): string { return $this->foo; } } $f = new HelloWorld(); $c = clone $f;
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Cannot modify readonly property Bug11495\HelloWorld::$foo in /in/oaLm9:18 Stack trace: #0 /in/oaLm9(28): Bug11495\HelloWorld->__clone() #1 {main} thrown in /in/oaLm9 on line 18
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:
46.12 ms | 405 KiB | 5 Q