By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

case-insensitive Class Constants possible?

P: n/a
weird issue i ran into today...

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????

Thanks,

Alex
Oct 17 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 17 Oct 2008 20:41:05 +0200, Alex Weber <al*********@gmail.com
wrote:
weird issue i ran into today...

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?
It isn't there.
How can i define a case-insensitive Class Constant????
You can't, you'll just have to live with taking that into account while
coding :P. I personally like my constants like I like my variables: case
sensitive.
--
Rik Wasmus
Oct 22 '08 #2

P: n/a
On Oct 17, 7:41*pm, Alex Weber <alexwebe...@gmail.comwrote:
weird issue i ran into today...

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????

Thanks,

Alex
You can't, and to be honest you shouldn't be able to treat defines as
case insensitive.

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';
Oct 22 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.