magic getter
| From: | Sebastian | Date: | Thu, 19 Jul 2012 19:22:07 +0000 |
| Subject: | magic getter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-318519@lists.php.net to get a copy of this message | ||
Hi all,
is this a bug, or a feature?
class Foo
{
private $data;
public function __get($name)
{
return $this->data[$name];} } $foo = new Foo(); $foo->color = 'red'; echo $foo->color; I would expect an error, or a least a notice, but it prints out "red" ...