is_bool
Detect whether the variable is boolean
is_bool()
function checks whether the variable is a Boolean value.
If the variable is a Boolean, this function returns true
(1), otherwise false
/ none (returns nothing).
Check if the variable is a boolean value:
<?php $a = 1 ; echo "a is " . is_bool ( $a ) . "<br>" ; $b = 0 ; echo "b is " . is_bool ( $b ) . "<br>" ; $c = true ; echo "c is " . is_bool ( $c ) . "<br>" ; $d = false ; echo "d is " . is_bool ( $d ) . "<br>" ; ?>
Try it yourself
is_bool ( variable ) ;
parameter | describe |
---|---|
variable | Required. Specifies the variable to check. |