Advice on Constants - Notice: Undefined Constant
| From: | Adam Douglas | Date: | Wed, 09 Apr 2003 17:16:18 +0000 |
| Subject: | Advice on Constants - Notice: Undefined Constant | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143118@lists.php.net to get a copy of this message | ||
I'm currently developing a web site that stores two security levels of the
client logged in. These security levels and including a few other variables
are returning a PHP notice statement, "Notice: Undefined constant...". Now
these variables are set at initial login into the web site and are stored
into a the session file to reduce security checking routines and with the
concept of why do a check again when we already know the value.
To resolve this PHP notice issue I figured no big deal I will just declare
the variable as a constant using define(). But by doing this correct me if
I'm wrong you now no longer refer to the variable with a dollar sign and the
variable name. Which is fine but can I store the constant into the session
file?
My concern and question is what the best direction to resolve this? At
present if I just define the variables as a constant I get another PHP
message "Notice: Undefined offset..." throughout my code when referencing my
session variable (_SESSION[name]).
Any advice would be greatly appreciated.