[PHP] variable test

2002-03-21 Thread atu

Hi,

I'm asking me, what is the difference of the two ifs.

if($x)
   echo $x;

if(!empty($x))
   echo $x;

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] variable test

2002-03-21 Thread Andrey Hristov

 
 if($x)
echo $x;

if $x is not defined you will get a warning but that depends on error settings in 
php.ini.
This construction checks whether $x is defined or $x is true.

 
 if(!empty($x))
echo $x;

$x must be defined.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php