Not until PHP 5
Class Foo
{
static $_TintBaz = 9;
}echo Foo::$_TintBaz;
in PHP 4, you can kludge this:
Class Foo
{
function getBaz($set = null)
{
static $_TintBaz = 9;
if (!is_null($set)) {
$_TintBaz = $set;
}
return $_TintBaz;
}
}Greg -- phpDocumentor http://www.phpdoc.org
Jswalter wrote:
Is there a way that a method within a Class, when called statically, can access a property of that Class?
Class Foo { var $_TintBaz = 9;
function getBaz() { return Foo::_TintBaz; // <-- line 8 } }
echo Foo::getBaz();
This returns...
Parse error: parse error, unexpected ';', expecting '(' in test 02.php on line 8
And of course, can't use 'return Foo::_TintBaz;' in a statically called Class.
Is there any hope?
Thanks
Walter
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

