When converted to Boolean, the following values are considered FALSE:
The Boolean value of FALSE itself
The integer value 0 (0)
The floating-point value 0.0 (0)
An empty string, and the string "0"
An array that does not include any elements
Objects that do not include any member variables (PHP 4.0 only applies)
Special type NULL (including variables that have not been set)
SimpleXML object generated from an XML document without any tags (tags)
All other values are considered TRUE (including any resources).
Warning
-1 and other non-0 values (either positive or negative) are considered to be true!
Copy the Code code as follows:
Var_dump ((BOOL) ""); BOOL (FALSE)
Var_dump ((bool) 1); BOOL (TRUE)
Var_dump ((BOOL)-2); BOOL (TRUE)
Var_dump ((bool) "foo"); BOOL (TRUE)
Var_dump ((bool) 2.3e5); BOOL (TRUE)
Var_dump ((BOOL) array (12)); BOOL (TRUE)
Var_dump ((bool) array ()); BOOL (FALSE)
Var_dump ((BOOL) "false"); BOOL (TRUE)
Boolean to string when,true=>1,false=> "";
http://www.bkjia.com/PHPjc/824983.html www.bkjia.com true http://www.bkjia.com/PHPjc/824983.html techarticle when converted to Boolean, the following values are considered to be false:the boolean FALSE itself the integer value 0 (0) The floating-point value 0.0 (0) The empty string, and the string "0" does not include any ...