RE: [PHP] help with undefined variables, please

From: Date: Tue, 14 May 2002 19:57:02 +0000
Subject: RE: [PHP] help with undefined variables, please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-97617@lists.php.net to get a copy of this message
At 12:49 14/05/2002 -0600, Matthew Walker wrote:
I prefer to use isset(), not empty(). It's more accurate, in that it knows the difference between a variable that just isn't set, and one that has an empty value (which may be valid).
hello, You may want to do some tests. last time i did that :
4.1 => isset() returns false if the variable is not set OR if the variable is empty
So for example <form blabla..> <input type="text" name="foo"> </form> For php > 4.1 foo is ALWAYS set (it can be empty if no value is typed, but it exists so it is set) If you want to know is the user typed something you must use empty() Luc

« previous php.general (#97617) next »