...

View Full Version : empty a PHP constant value



crmpicco
09-09-2009, 12:33 PM
Does anyone know the best way to empty the value of a constant?

I have:


define("CRMPICCO_RANGERS", true);

However, i'd like to be clear this value in the code somewhere. How would I go about doing that?

Cheers,
Picco

fifth
09-09-2009, 12:41 PM
Does anyone know the best way to empty the value of a constant?

I have:


define("CRMPICCO_RANGERS", true);

However, i'd like to be clear this value in the code somewhere. How would I go about doing that?

Cheers,
Picco

If you need to change the value then its not a constant. You would need to use a global variable instead, but I would advise a re-work of the code to avoid this situation.

CFMaBiSmAd
09-09-2009, 12:42 PM
Um. The whole point and definition of a Constant is that it is a constant. If you want to change it, including clear it, you should not be using a Constant.

crmpicco
09-09-2009, 01:50 PM
Yeah, absolutely. It was more for testing than actually part of the development. I just wanted to clear it to test some code. It's fine though, I just cleared it where the constant is being defined.

Cheers.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum