note 26922 added to keyword.paamayim-nekudotayim

From: Date: Mon, 18 Nov 2002 02:12:59 +0000
Subject: note 26922 added to keyword.paamayim-nekudotayim
Groups: php.notes 
Request: Send a blank email to php-notes+get-39610@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(); ?> -- http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php http://master.php.net/manage/user-notes.php?action=edit+26922 http://master.php.net/manage/user-notes.php?action=delete+26922 http://master.php.net/manage/user-notes.php?action=reject+26922

« previous php.notes (#39610) next »