The Boolean type is the simplest type in PHP. It can have a value of TRUE or FALSE.
Such as:
$foo =false;
$foo 1=true;
echo "is false when the output value is:". $foo; No output value
echo "<br/> is true when the output value is:". $foo 1; Output 1
Here are the main details:
When converted to Boolean, the following values are considered FALSE:
1, the Boolean value FALSE itself
2, the integer value of 0 (0)
3, the floating-point value of 0.0 (0) empty string, and the string "0"
4, does not include any elements of the array
5. Objects that do not include any member variables (PHP 4.0 applies only)
6. Special type NULL (including variables not yet set)
7. SimpleXML objects generated from XML documents without any tags (tags)
$a = 0;
$a = 0.0;
$a = "0";
Var_dump ((bool) 0);
echo "<br/>";
Var_dump ((bool) array ());
if ($a ==false) {
echo "Null 0 is converted to False by default, successful!" ";
}else{
echo "cannot be converted to false";
}
Output:
BOOL (FALSE)
BOOL (FALSE) NULL 0 the default conversion to FALSE, successful!