PHP is_bool() function
In this chapter you will learn:
- Description for PHP is_bool() function
- Syntax for PHP is_bool() function
- Parameter for PHP is_bool() function
- Return value for PHP is_bool() function
- Example - Is it a boolean value
Description
is_bool(value) returns true if value is a Boolean.
Syntax
PHP is_bool() function has the following syntax.
is_bool(value)
Parameter
- value is the variable being type checked.
Return
Returns true if value is a Boolean.
Example
Is it a boolean value?
<?php/*from j av a 2 s . c om*/
$values = array(2, "2", 2.5, "2.5", null, true);
foreach ($values as $value) {
echo "is_bool(";
var_export($value);
echo ") = ";
var_dump(is_bool($value));
}
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Description for PHP is_float() function
- Syntax for PHP is_float() function
- Parameter for PHP is_float() function
- Return value for PHP is_float() function
- Example - Is it a float type variable
Home » PHP Tutorial » PHP Data Type Functions