Re: Warning: Undefined variable

From: Date: Tue, 02 Apr 2002 20:27:54 +0000
Subject: Re: Warning: Undefined variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-91214@lists.php.net to get a copy of this message
> > Good little programmers define variables before > > using them, or at least before evaluating them. > > Really? I'm not arguing with you, I'm curious: I thought that it was a > valued feature of newer scripting languages that they do not require > declaration of variables. At least that's what people say when they > praise PHP or Python or whichever language allows this. > > Is this "feature" not as desirable as what I had first heard? If you turn down error reporting then you don't have to worry about it, so it depends on you. So you're correct, it is not "required" but still it's nice. For example, if you're debugging a script you'll instantly know that you're using a undefined variable somewhere, perhaps a typo? E_NOTICE also applies to non-existent array keys, and other things. If you're distributing code in cyberspace it's a good idea to make it error free too, E_NOTICE or otherwise. Regards, Philip Olson

« previous php.general (#91214) next »