Re: undefined variable notice - how to furn of
| From: | Philippe Saladin | Date: | Fri, 10 Jan 2003 09:47:41 +0000 |
| Subject: | Re: undefined variable notice - how to furn of | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131068@lists.php.net to get a copy of this message | ||
>Everything works fine, just now I'm getting "Notice" messages for every
undefined variable or undefined index in arrays..
>So now I have to use issset() everytime to avoid this messages...
you would initialize your variables in the beginning of your scripts. With
that, you don't need isset().
>..is there any way to turn this messages off, because if prior versions I
never got them..??
ok, the other guys have answered with error_reporting(E_ALL ~E_NOTICE) or
error_reporting(E_NONE).
But don't you think it would be a best practice to set error reporting to
E_ALL and initialize your variables ? your script would work, regardless of
the configuration of php.ini, and would be more portable.
error_reporting(E_ALL) and register_globals = off are IMHO a good way to
have better code.
In fact, I use error_reporting(E_ALL) on my test server, and
error_reporting(E_NONE) (or a file log) on the production one.
Best regards,
Philippe