3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __set($key, $value) { trigger_error("Class uses undeclared property: " . __CLASS__ . "->" . $key, E_USER_WARNING); $this->{$key} = $value; } public function usesDynamicProp() { $this->undeclaredProp = "test value"; } public function getsDynamicProp() { var_dump($this->undeclaredProp); } } $o = new Test(); $o->usesDynamicProp(); $o->getsDynamicProp(); // Subsequent calls do not trigger the warning because the property exists, so it will only occur once per script execution $o->usesDynamicProp();

preferences:
27.49 ms | 405 KiB | 5 Q