note 7704 deleted from control-structures by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 23:10:27 +0000 |
| Subject: | note 7704 deleted from control-structures by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23541@lists.php.net to get a copy of this message | ||
It took me about 15 minutes to run this info down... and while it may seem basic to most of us, I
looked for this info here first. http://www.php.net/manual/html/language.expressions.html
is where I found this info.<br><br>
In many events, mainly in conditional execution and loops, you're not interested in the
specific value of the expression, but only care about whether it means TRUE or FALSE (PHP
doesn't have a dedicated boolean type).<br><br>
The truth value of expressions in PHP is calculated in a similar way to perl. Any numeric non-zero
numeric value is TRUE, zero is FALSE. Be sure to note that negative values are non-zero and are thus
considered TRUE!<br><br>
The empty string and the string "0" are FALSE; all other strings are TRUE. With non-scalar
values (arrays and objects) - if the value contains no elements it's considered FALSE,
otherwise it's considered TRUE.