PHP is_numeric() Function

The is_numeric() function in PHP finds whether the specified variable is a number or a numeric string. It returns a Boolean value TRUE if the specified var is a number or a numeric string else it returns FALSE otherwise.

Syntax

is_numeric ( mixed $var )

var(required)- This parameter represents the value to check.

Return

This returns a Boolean value TRUE if the specified var is a number or a numeric string else it returns FALSE.

Example 1

 

Output

bool(true)
bool(false)
bool(false) 

Example 2

 

Output

1232 is a numeric value. 

Example 3

 

Output

bool(true)
bool(true)
bool(true) 

Example 4

 

Output

The var is not numeric

Example 5

 

Output:

The var is numeric