3v4l.org

run code in 500+ PHP versions simultaneously
<?php final class DemoFile { private readonly string $method; public static function create(int $a): static { $self = new static(); $self->method = 'hi'; if ($a > 0) { $self->method = 'hello'; } return $self; } } $demo = DemoFile::create(2); var_dump($demo);
Output for git.master, git.master_jit
Fatal error: Uncaught Error: Cannot modify readonly property DemoFile::$method in /in/hv7TE:12 Stack trace: #0 /in/hv7TE(18): DemoFile::create(2) #1 {main} thrown in /in/hv7TE on line 12
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:
48.65 ms | 681 KiB | 4 Q