PHP Tutorial - PHP is_nan() Function






Definition

The is_nan() function checks whether a value is 'not a number'.

Syntax

PHP is_nan() Function has the following syntax.

is_nan(value);

Parameter

ParameterIs RequiredDescription
value Required. Value to check

Return

Item Description
Return Value TRUE if value is 'not a number', FALSE otherwise
Return TypeBoolean

This function returns true (1) if the specified value is 'not a number', otherwise it returns false/nothing.





Example

Check whether a value is 'not-a-number':


<?php
echo is_nan(200) . "\n";
echo is_nan(acos(1.01));
?>

The code above generates the following result.