On October 6, 2004 15:34, Chris Boget wrote:
> Unfortunately, in PHP4.3.2 that doesn't seem to be working... :(
> Does anyone know how I can access a class' variable w/o having
> to instantiate an object of the class? This is more to the point of
> what I'm trying to do:
>
> Since PHP4 doesn't have enums, I'm doing this:
>
> class MyEnums {
> var $this = 'This';
> var $that = 'That';
> var $other = 'Other';
> }
Chris,
A work around I've used in the past has been to use a keyed array such as:
$MyEnums = array(
"is" => "This",
"at" => "That",
"er" => "Other"
);
Then you can refer to them like:
echo($MyEnums["is"]); // Prints "This"
Just an idea.
HTH
--
Regards,
David Bevan
We could learn a lot from crayons:
some are sharp, some are pretty, some are dull, some have weird names,
and all are different colors....but they all exist very nicely in the same
box.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php