is_bool
(PHP 4, PHP 5)
is_bool — 変数が boolean であるかを調べる
説明
bool is_bool
( mixed $var
)
指定した変数が boolean であるかどうかを調べます。
パラメータ
- var
-
評価する変数。
返り値
var が boolean である場合に TRUE 、それ以外の場合に FALSE を返します。
例
Example#1 is_bool() の例
<?php
$a = false;
$b = 0;
// $a は boolean なので、これは true です
if (is_bool($a)) {
echo "Yes, this is a boolean";
}
// $b は boolean ではないので、これは true ではありません
if (is_bool($b)) {
echo "Yes, this is a boolean";
}
?>