Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- case-insensitive Class Constants possible?
- Alex Weber
October 17, 2008, 6:41 pm
rate this thread
its possible to define case-insensitive constants outside the scope of
a class using:
define('name', 'value', false);
however, you cannot use define() for Class Constants, to define a
Class Constant you have to use (inside class scope):
const 'name' = 'value';
So what happened to case-sensitivity here?
How can i define a case-insensitive Class Constant????
Re: case-insensitive Class Constants possible?
You can't, and to be honest you shouldn't be able to treat defines as
TIP: It's generally considered programmer convention to type constants
as all upper case so you can tell at first glance that it's a constant
and not a variable. Example:
define ('GLOBAL_CONSTANT', 'I\'m a global constant');
const CLASS_CONSTANT = 'I\'m a class constant';