Page 1 of 1

The value of the empty() function?

Posted: Mon Aug 04, 2003 4:16 pm
by Nigel Moore
I'm just getting started with PHP, but I couldn't find a discussion on this subject. A number of posters on the PHP manual decry the empty() function, but they be viewing it solely from what they want to do.

But my question is this....

I'm using empty() to determine whether or not a string variable is returned from a database. Am I correct in thinking that

Code: Select all

if (empty($var)) {...
is the same as

Code: Select all

if (!$var) {...
and that, similarly,

Code: Select all

if (!empty($var)) {...
and

Code: Select all

if (!$var) {...
are the same?