Home  >  Article  >  Backend Development  >  PHP - Determination of Boolean type

PHP - Determination of Boolean type

WBOY
WBOYOriginal
2016-07-29 09:16:161310browse
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/48224955

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Object-oriented PHP (4)Next article:Object-oriented PHP (4)