magic getter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" ...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux