Page 1 of 1

how to define enums in PHP under a specific scope

Posted: Thu Aug 19, 2004 8:26 am
by jasongr
Hello

I am using PHP5 and I would like to define constants that should only be defined under a specific scope (for example a class scope).

Is there a way to define enums under a class scope so that they won't occupy memory in the class (like constants do)?

If I would define my constants as:
public static $CONSTANT = 1;
then the static variable will occupy memory for the class

I know that constants that are defined using define() do not take memory because the preprocessor replaces them before the code runs.
Is is also true in PHP?

regards
Jason