3v4l.org

run code in 300+ PHP versions simultaneously
<?php function initialize_properties_here($object) { $object->bar = 123; } class Foo { public int $bar; public function __construct() { unset($this->bar); } public function __get(string $name) { initialize_properties_here($this); } } var_dump((new Foo())->bar);

preferences:
58.4 ms | 402 KiB | 5 Q