Possible Duplicate:
Regarding if statements in PHP
this is a simple question. But Here I need to know how if condition work with only one variable.
$category='';
if ($category) {
}
can you tell what actually check in If condition? Condition has only one variable..
is it checking variable is TRUE or FALSE?
PHP is a weak typed language. To understand what is evaluated in the
ifcondition, see the conversion rules for booleans.Quoting from the manual:
Therefore, your condition will be evaluated as
FALSE, since$category == ''and(bool) '' === FALSE