is_numeric

(FW >= 1.0)

is_numeric - checks if a variable is an integer or float

Description

int is_numeric( mixed $var )
Returns 1 if the variable is numeric, otherwise returns 0

Parameters

var

variable to check

Return Value

returns 1 if the variable is numeric

Examples

<? 
$x=1.0;
print(is_numeric($x)); // outputs 1 since x is a float
$y=1;
print(is_numeric($y)); // outputs 1 since y is an int
$z="cool";
print(is_numeric($z)); // outputs 0 since z is not numeric
$z="1";
print(is_numeric($z)); // outputs 1 since z is not numeric string

?>