bool is_bool ( mixed $var )
is_bool() checks whether a variable is a boolean or not.
※ available F/W version : all
Returns TRUE if $var is a boolean, otherwise FALSE.
<?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
?>
is_array() / is_float() / is_int() / is_string()
This function is identical to the PHP group’s is_bool().