is_bool

bool is_bool(mixed value) 

Tests whether a value is a boolean.

Returns:

TRUE if the value is a boolean; FALSE otherwise

Description:

is_bool() checks whether value is a boolean. If so, the function returns TRUE. If not, FALSE is returned.

Availability:

UNIX, Windows

Version:

3+, 4+

See also:

gettype() 

Example:

Check whether a value is a boolean
$value = NULL; 
is_bool ($value) 
    or die ('<b>Exiting Program:</b> Variable $value is not a boolean!'); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.