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);

preferences:
56.83 ms | 690 KiB | 5 Q