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

PHP - Determination of Boolean type

WBOY
Release: 2016-07-29 09:16:16
Original
1369 people have browsed it
转载请注明出处: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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template