Source Code:
(back to article)
<?php class MyClass { public function __set($name, $value) { $this->$name = $value; } } $obj = new MyClass(); $propertyName = 'newProperty2'; $obj->$propertyName = "Hello World"; echo $obj->$propertyName;
Result:
Report an issue