PHP is_nan() Function

In this chapter you will learn:

  1. Definition for PHP is_nan() Function
  2. Syntax for PHP is_nan() Function
  3. Parameter for PHP is_nan() Function
  4. Return for PHP is_nan() Function
  5. Example - Check whether a value is 'not-a-number'

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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP lcg_value() Function
  2. Syntax for PHP lcg_value() Function
  3. Parameter for PHP lcg_value() Function
  4. Return for PHP lcg_value() Function
  5. Example - Return a pseudo random number in a range between 0 and 1