: This article mainly describes the determination of the Boolean type in PHP. For more information about PHP tutorials, see.
Reprinted please indicate the source: http://blog.csdn.net/l1028386804/article/details/48224955
When converted to boolean, the following values are considered FALSE:
- Boolean value FALSE
- Integer value 0 (0)
- Floating point value: 0.0 (0)
- Empty string and string "0"
- Array that does not contain any elements
- Objects that do not include any member variables (applicable only to PHP 4.0)
- Special type NULL (including unassigned variables)
- SimpleXML object generated from null tag
All other values are considered to be TRUE (including any resources ).
Note:
-1 is considered TRUE like other non-zero values (both positive and negative values!
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes the determination of the Boolean type of PHP, including the content, and hope to be helpful to friends who are interested in the PHP Tutorial.