class foo {
static public $a = 1;
public function __construct() {
echo $this->a; /* does not work */
echo foo::$a; /* work */
}
}
>Can someone please explain to me why I have to call $a outside the class
>to get the value?
I guess, it works like that because there is static declaration of
variable - which means above class allows to make only one instance of
variable - so you may refer to variable through class instance (only one
instance in memory) and you may not refer to variable through object
instances (multiple instances).
Bests.,
Xtlan.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php