Re: Undefined variables

From: Date: Sun, 31 Mar 2002 01:33:47 +0000
Subject: Re: Undefined variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90842@lists.php.net to get a copy of this message
On Sat, 2002-03-30 at 17:30, Ernesto wrote: > Hi, newbie here. > > I was erroneously using "error_reporting=E_ALL ~E_NOTICE" on my debug > server. > Now, I changed it to "error_reporting=E_ALL" and I can see lots of warnings > about using undefined variables. > So, if I don't want to see warnings all over the place, I have to check > every variable with isset() before I use it. > Is it necesary that I do this all the time? Why can't I trust on the > "emptiness" of uninitialized variables? > I'm using "register_globals=Off", so there should be no problem with that. > > I know it's a good practice to declare and initialize all variables, but I > need my scripts to run as fast as they can (and I'm too lazy to check every > variable before I use it, too :-) > > So... do I have any choice? > > Regards, > Ernesto Not really. You either have to init your variables or turn off notices in error_reporting() (or otherwise suppress them; i.e. display_errors = off). -- Torben Wilson <torben@php.net> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506

« previous php.general (#90842) next »