Re: static class call..
| From: | Greg Beaver | Date: | Sat, 27 Sep 2003 05:20:47 +0000 |
| Subject: | Re: static class call.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164080@lists.php.net to get a copy of this message | ||
Hi Walter,
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 8And of course, can't use 'return Foo::_TintBaz;' in a statically called Class. Is there any hope? Thanks Walter