Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,093
    Thanks
    15
    Thanked 1 Time in 1 Post

    Question empty a PHP constant value

    Does anyone know the best way to empty the value of a constant?

    I have:

    PHP Code:
     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

  • #2
    New Coder
    Join Date
    Jun 2009
    Posts
    20
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by crmpicco View Post
    Does anyone know the best way to empty the value of a constant?

    I have:

    PHP Code:
     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.

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,009
    Thanks
    2
    Thanked 312 Times in 304 Posts
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #4
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,093
    Thanks
    15
    Thanked 1 Time in 1 Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •