Current Location: Home> Function Categories> is_bool

is_bool

Detect whether the variable is boolean
Name:is_bool
Category:Variable processing
Programming Language:php
One-line Description:Checks whether the variable is a boolean value.

Definition and usage

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).

Example

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

grammar

 is_bool ( variable ) ;
parameter describe
variable Required. Specifies the variable to check.
Similar Functions