SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Undefine a constant?

    Hi...

    Is it possible to undefine (or redefine would also work) a constant?

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Location
    Ontario, Canada
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    um, I don't think so. But if you really need to change or delete a constant, you may want to reconcider what you are using it for. Constants are just that: constant. They are never saposed to change. Just as well, a variable is just that: variable. If the value is ever saposed to change, then it is a variable.

  3. #3
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya, I know that.

    And I know that the "official" word is that it can't be done in PHP.

    My situation is that an external library defines a constant that I use in my applications. I know I could just go through and change it's name to avoid conflicts, but this raised more of a theoretical question

  4. #4
    SitePoint Addict SirAdrian's Avatar
    Join Date
    Jul 2005
    Location
    Kelowna, BC
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wait until the script is finished executing.
    Adrian Schneider - Web Developer

  5. #5
    SitePoint Enthusiast icehawk219's Avatar
    Join Date
    Aug 2006
    Location
    New Jersey
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once a constant is defined you are unable to re-define or un-define it. There is no way I know of to go around this.

  6. #6
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    Belgian in Mexico
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From the PHP manual:
    Once a constant is defined, it can never be changed or undefined.
    MichaŽl Niessen
    http://assemblysys.com
    (Countries/states/cities with latitude & longitude,
    weathercodes & topical databases)


Bookmarks

Posting Permissions

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