Re: class (not class instance) variables
| From: | Andrzej Swedrzynski | Date: | Sat, 05 May 2001 20:36:42 +0000 |
| Subject: | Re: class (not class instance) variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51568@lists.php.net to get a copy of this message | ||
On Sun, 6 May 2001, Steven Haryanto wrote:
> Am I correct that PHP does not support class variables? That is,
> variables that belong to a class and not copied into every object.
> I need to put several arrays for information about a class, and I
> do not want to bloat every object with this data (since potentially
> I will create many instances of the class).
>
> Currently I do this with methods. Any other alternative?
For every class I do create additional class called MetaXXX where
XXX is the name of the original class. In the MetaXXX I do decla
re all variables and methods which I would make static in other
language such as C++ or Java. Then I do create one and only one
object of class MetaXXX (called metaXXX for convenience) which is
available in global scope. Hope this will help you.
Regards,
Andrzej
--
http://kokosz.horyzont.net
http://www.earthdawn.pl