English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
is_bool() The function is used to check if a variable is of boolean type.
PHP Version Requirement: PHP 4, PHP 5, PHP 7
bool is_bool ( mixed $var )
Parameter Description:
If var is boolean, it returns TRUE.
<?php $a = false; $b = 0; // Because $a is of boolean type, the result is true if (is_bool($a)) { print "Variable a is of boolean type"; } // Because $b is not of boolean type, the result is false if (is_bool($b)) { print "Variable b is of boolean type"; } ?>
The output result is:
Variable a is of boolean type