Re: Advice on Constants - Notice: Undefined Constant (correction)
| From: | Mukul Sabharwal | Date: | Wed, 09 Apr 2003 17:27:16 +0000 |
| Subject: | Re: Advice on Constants - Notice: Undefined Constant (correction) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143123@lists.php.net to get a copy of this message | ||
error_reporting = E_ALL
defines all errors, notices, everything
error_reporting = E_ALL & ~E_NOTICE
will displays all errors, except notices!
Sorry.
--- Mukul Sabharwal <mukulsabharwal@yahoo.com> wrote:
> Hi,
>
> Notices are generated when you have error_reporting
> in
> your php.ini set to E_ALL & ~E_NOTICE
>
> Notices can be helpful at times, but on production
> sites, generally donot help, because hidden input
> form
> fields (not yet set), can show up as undefined.
>
> As regarding to your question, the constant is
> defined
> and replaced internally in all your places in your
> php
> script.
>
> Incase you want to store a constant value
> dynamically
> you need to call a function called "constant", which
> returns the value of a constant.
>
> http://in.php.net/manual/en/function.constant.php
>
> As for the NOTICE of an undefined offset, indicates
> that the array element is not present.
>
>
> Regards,
> Mukul Sabharwal
> http://www.devhome.org
>
>
>
> --- Adam Douglas <ADouglas@venmarces.com> wrote:
> > 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.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online, calculators, forms,
> and more
> http://tax.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
*********************************
Know more about me:
http://www.geocities.com/mimodit
*********************************
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com