note 26924 rejected from keyword.paamayim-nekudotayim by nicos
| From: | nicos@php.net | Date: | Mon, 18 Nov 2002 02:20:08 +0000 |
| Subject: | note 26924 rejected from keyword.paamayim-nekudotayim by nicos | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39613@lists.php.net to get a copy of this message | ||
You can implement a getter/setter pair to emulate a class variable. The syntax isn't so weird:
<?
class A{
function getVar($val=NULL){
static $class_variable = 0;
if($val != NULL){
$class_variable = $val;
}
return $class_variable;
}
function setVar($val=0){
return A::getVar($val);
}
}
A::setVar(3);
print A::getVar();
?>