is_bool()


bool is_bool ( mixed $var )

Description

is_bool() checks whether a variable is a boolean or not.

※ available F/W version : all

Parameters

Return values

Returns TRUE if $var is a boolean, otherwise FALSE.

Example

<?php
$val1 = TRUE;
$val2 = 1;

$ret1 = is_bool($val1);
$ret2 = is_bool($val2);

if($ret1) echo "ret1 is a bool\r\n";  // OUTPUT: ret1 is a bool
else echo "ret1 is NOT a bool\r\n";

if($ret2) echo "ret2 is a bool\r\n";
else echo "ret2 is NOT a bool\r\n";  // OUTPUT: ret2 is NOT a bool
?>

See also

is_array() / is_float() / is_int() / is_string()

Remarks

This function is identical to the PHP group’s is_bool().