3v4l.org

run code in 300+ PHP versions simultaneously
<?php readonly class Foobar { public function __construct(public string $foo) {} } try { $reflection = new ReflectionClass(Foobar::class); $obj = $reflection->newInstanceWithoutConstructor(); echo $obj->foo, PHP_EOL; } catch (Throwable $exception) { echo $exception->getMessage(), PHP_EOL, $exception::class, PHP_EOL, implode(PHP_EOL, class_parents($exception)); }
Output for git.master, git.master_jit
Typed property Foobar::$foo must not be accessed before initialization Error

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