PHP is_bool() 函数
PHP 教程
· 2019-01-31 16:57:16
is_bool() 函数用于检测变量是否是布尔型。
PHP 版本要求:PHP 4, PHP 5, PHP 7
语法
bool is_bool ( mixed $var )
参数说明:
- $var:要检测的变量。
返回值
如果 var 是 boolean 则返回 TRUE。
实例
实例
$a = false;
$b = 0;
// 因为 $a 是布尔型,所以结果为 true
if (is_bool($a)) {
print "变量 a 是布尔型";
}
// 因为 $b 不是布尔型,所以结果为 false
if (is_bool($b)) {
print "变量 b 是布尔型";
}
输出结果为:
变量 a 是布尔型
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Prometheus: Up & Running
Brian Brazil / O'Reilly Media / 2018-7-9 / USD 49.99
Get up to speed with Prometheus, the metrics-based monitoring system used by tens of thousands of organizations in production. This practical guide provides application developers, sysadmins, and DevO......一起来看看 《Prometheus: Up & Running》 这本书的介绍吧!