Check if a value is not a number in PHP

Description

The following code shows how to check if a value is not a number.

Example


<?php//  www . j a  v a 2  s  .c o  m
// Invalid calculation, will return a
// NaN value
$nan = acos(8);

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

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition