The value of the empty() function?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nigel Moore
Forum Newbie
Posts: 3
Joined: Mon Aug 04, 2003 4:16 pm

The value of the empty() function?

Post 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?
Post Reply