PHP is_bool Function

What is is_bool() in PHP?

Explanation

is_bool function checks whether the given input value is boolean or not.

Syntax:


is_bool(variable)

Example :


<?php
$val=123;
if(is_bool($val))
{
echo "This is a Boolean Value";
}
else
{
echo "This is not a Boolean Value";
}
?>

Result :

This is not a Boolean Value

Check if a variable is a boolean value using PHP is_bool function.

PHP Topics


Ask Questions

Ask Question