When converted to boolean, the following values are considered FALSE:
the Boolean value FALSE itself
the integer value 0 (zero)
the floating point value 0.0 (zero)
Empty string, and string "0"
Array containing no elements
An object that does not include any member variables (only applicable to PHP 4.0)
Special type NULL (including variables that have not been set)
SimpleXML object generated from an XML document without any tags
All other values are considered TRUE (including any resources).
Warning
-1, like other non-zero values (positive or negative), is considered TRUE!
Copy code The code is 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)
When converting Boolean to string, true =>1,false=>"";
http://www.bkjia.com/PHPjc/824983.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824983.htmlTechArticleWhen converted to boolean, the following values are considered FALSE: the boolean value FALSE itself the integer value 0 ( zero) the floating point value 0.0 (zero) the empty string, and the string "0" does not include any...