is_numeric

bool is_numeric(mixed value) 

Tests whether a value is a number or a numeric string.

Returns:

TRUE if the value is a numeric value; FALSE otherwise

Description:

is_numeric() checks whether value is a number or a numeric string. If so, the function returns TRUE. If not, FALSE is returned.

The function recognizes any normal numeric value, as well as numbers that are represented in scientific notation (such as 8.79e-43), in octal base notation (such as 01000 or 02177), or in hexadecimal base notation (such as 0x0FF or 0xODE).

It also recognizes numbers contained within strings—however, the string must contain only a number. Any characters that are not part of a valid number will cause the function to assume that the string is not a ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.