转载请注明出处:http://blog.csdn.net/l1028386804/article/details/48224955
Copy after login
When converted to boolean, the following values are considered FALSE:
- boolean FALSE itself
- integer value 0 (zero)
- floating point value 0.0 (zero)
- empty string, and string "0"
- An array that does not include any 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 assigned a value)
- SimpleXML objects generated from empty tags
All other values are considered TRUE (including any resources).
Note:
-1, like other non-zero values (whether positive or negative), is considered TRUE!
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the determination of Boolean type in PHP, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.