is_nan

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

is_nan判断是否为合法数值

说明

is_nan(float $num): bool

如果 num 为“非数值”,例如 acos(1.01) 的结果,则返回 true

参数

num

要检查的值

返回值

如果 num“不是数字”返回 true,否则返回 false

范例

示例 #1 is_nan() 例子

<?php
// 无效计算,将返回
// NaN 值
$nan = acos(8);

var_dump($nan, is_nan($nan));
?>

以上例程会输出:

float(NAN)
bool(true)

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top