Re: what's the diff between if($var1) and if(isset($var1)) and if(!empty($var1))???

From: Date: Tue, 22 May 2001 16:34:36 +0000
Subject: Re: what's the diff between if($var1) and if(isset($var1)) and if(!empty($var1))???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53879@lists.php.net to get a copy of this message
On Tuesday 22 May 2001 08:30, Rasmus Lerdorf wrote: > if(!empty($var1)) is true if $var1 is set to anything except a null-string I think this should be if(!empty($var1)) is true if $var1 is set to anything except a null string, 0 or the string '0' It would be great, unless I've missed the point somewhere along the line, if empty treated '0' (string) as not empty, then the function could be used for checking user input where the string '0' is perfectly valid. In thousands of lines of PHP code I haven't been able to use empty() once - I always end up going if(isset($var) && strcmp($var,''))... Just a dream :) -- Phil Driscoll

« previous php.general (#53879) next »