dealmaker
01-05-2006, 01:15 AM
Hi,
In C language, there is enum, and I can do the following:
enum {
DOG,
CAT,
BIRD,
MAX_NUM_OF_ANIMALS
};
There is no enum in php, how can I emulate enum in php? I want to do better than just use define() because I need to put use numbers like this "define(DOG, 0); define(CAT, 1);" and there is no way to access MAX_NUM_OF_ANIMALS without doing another define.
Many thanks.
In C language, there is enum, and I can do the following:
enum {
DOG,
CAT,
BIRD,
MAX_NUM_OF_ANIMALS
};
There is no enum in php, how can I emulate enum in php? I want to do better than just use define() because I need to put use numbers like this "define(DOG, 0); define(CAT, 1);" and there is no way to access MAX_NUM_OF_ANIMALS without doing another define.
Many thanks.