3v4l.org

run code in 300+ PHP versions simultaneously
<?php function initialize_properties_here(array $properties) { $properties['bar'] = 123; } class Foo { private int $bar = 123; public function __get(string $name) { $props = ['bar' => & $this->bar]; initialize_properties_here($props); return $this->$name; } } var_dump((new Foo())->bar);

preferences:
27.82 ms | 402 KiB | 5 Q