|
Posted by Jay Blanchard on 12/08/05 16:23
[snip]
it doesn't fail and is not imho foolish by definition ... the value of the
constant,
although changing stays the same for the duration of the request,
IIRC Rasmus himself once mentioned that it can be useful to be able to set
a constant to a 'dynamic' value like this - nuff said really :-)
[/snip]
Thanks for the education there Jochem, I'd forgotten about const mostly
because I am in the habit of declaring private static variables and using
get and set methods for this kind of thing because I do a lot of C++ work
too and the theory holds up in both languages. And it is correct in the fact
that a class constant cannot contain a function (as I hadn't clearly stated
earlier) as the OP had requested, the syntax would fail.
I guess that I am old school enough (I see John Nichel's hands racing to the
keyboard now!) that expect a constant to be just that. The concept of a
changing constant is what we would normally call a variable. I suppose that
a holy war could ensue over this. In the end a class constant is constant
and its visibility is public.
For the OP I found the following manual page;
http://us2.php.net/manual/en/language.oop5.constants.php
Navigation:
[Reply to this message]
|