PHP is_bool() function
ᴰᵒᵖᵖᵉˡᵍᵃⁿᵍᵉʳ 多佩尔甘格尔By using this function, we can check whether the variable is boolean variable or not.
Syntax
bool is_bool ( mixed $var )
Parameters
Parameter
Description
Is compulsory
var_name
The variable being evaluated.
compulsory
Returns
It return True if var is boolean, False otherwise.
Example 1
<?php
$x=false;
echo is_bool($x);
?>
Output:

Example 2
<?php
$y=false;
if (is_bool($y))
echo 'This is a boolean type.';
else
echo 'This is not a boolean type.';
?>
Output:
