[PHP5]__get, __set and isset()

From: Date: Tue, 31 Aug 2004 11:38:18 +0000
Subject: [PHP5]__get, __set and isset()
Groups: php.general 
Request: Send a blank email to php-general+get-195266@lists.php.net to get a copy of this message
Is it possible to do something like this : class foo { private $array = array(); function __construct() { ... } function __get($key) { return (isset($this->array[$key]) == false ? null : $this->array[$key]); } function __set($key, $value) { $this->array[$key] = $value; } } $foo = new foo(); if (isset($foo->bar) == false) $foo->bar = 'bar'; else echo $foo->bar; It seems that isset($foo->bar) return ALWAYS false. Bug ? Fred.

« previous php.general (#195266) next »