473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

case-insensitive Class Constants possible?

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
2 2011
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
19
by: Robert Scheer | last post by:
Hi. In VBScript I can use a Select Case statement like that: Select Case X Case 1 to 10 'X is between 1 and 10 Case 11,14,16 'X is 11 or 14 or 16 End Select
1
by: ST | last post by:
Hi, I'm trying to debug someone else's code, and I'm going thru this Select Case statement. I'm having problems with the "OTHER" case...in that when the first line of the case is false, it jumps...
2
by: cs168 | last post by:
Hi I am new in ASP programming so I do use the very basic and simple way to do all my stuff. Now I do really got stuck at how can I loop thru the calculation for all my selection.. My full code is as...
6
by: deanfamily11 | last post by:
I've set up a case statement to have my program determine where on the Cartesian plane a point the user enters is located. I keep getting the C2051 error when I compile. Any help? #include...
15
by: YitzHandel | last post by:
The following is an extract from my program, which I seperated out and compiled as its own program. The problem is that as soon as a case tests true, all the cases below it execute as well. So...
10
by: MLH | last post by:
Suppose the following... Dim A as Date A=#7/24/2005# I wish to compare value of A against 2 other values: 1) 8/1/2005 2) 9/1/2005 Which is better and why... First:
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
10
by: Chih-Hsu Yen | last post by:
I encountered a strange problem about switch-case statement. switch(cmd) { case 1: statements; break; case 2: statements; break; ... .... case 11: S1; S2; S3; statements;
22
by: John | last post by:
Hi Folks, I'm experimenting a little with creating a custom CEdit control so that I can decide on what the user is allowed to type into the control. I started off only allowing floating point...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.