3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { private $prop = array(); public function &__get($name){ if(!array_key_exists($name, $this->prop)){ $this->prop[$name] = null; } return $this->prop[$name]; } public function __set($name, $val){ $this->prop[$name] = $val; } } $test = new test(); $test->a[] = 5; var_dump($test);

preferences:
57.4 ms | 402 KiB | 5 Q