PHP is_nan() Function

Definition and Usage

NAN stands for "Not A Number". The is_nan() function checks whether its argument is not a number.

Syntax

is_nan ( float $val ) : bool

Parameters

Sr.No Parameter & Description
1 val
The value to be verified if infinite or not

Return Values

PHP is_nan() function returns TRUE if val is "not a number", otherwise it returns FALSE.

PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

Example

<?php
   $val=sqrt(-1);
   $ret=is_nan($val);
   var_dump($val, $ret);
?>

Output

This will produce following result −

float(NAN)
bool(true)
Updated on: 2026-03-11T23:22:53+05:30

962 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements