w3resource

PHP: is_nan function

Description

The is_nan() function is used to find whether a value is not a number.

Version

(PHP 4 and above)

Syntax:

is_nan (num)

Parameter:

Name Description Required /
Optional
Type
num The value to be checked. Required Float

Return value:

TRUE if val is not a number otherwise FALSE.

Value Type : Boolean.

Pictorial Presentation:

php-math-is_nan()

Example:

<?php
$nval1=10.21;
$nval2=acos(1.02);
$nval3=500;
$zisf1=is_nan($nval1);
$zisf2=is_nan($nval2);
$zisf3=is_nan($nval3);
echo "$nval1 is is_nan : $zisf1<br />";
echo "$nval2 is is_nan : $zisf2<br />";
echo "$nval3 is is_nan : $zisf3<br />";
?>

Output:

10.21 is is_nan :
NAN is is_nan : 1
500 is is_nan : 

View the example in the browser

See also

PHP Function Reference

Previous: is_infinite
Next: is_nan



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/is_nan.php