User Tools

Site Tools


uphp:functions:is_int

is_int

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Check if a variable is an integer

Description

int is_int ( mixed $variable )

Check to see if a variable or value is of type int (an integer)

Parameter

$variable: Variable or expression to be evaluated

Return Values

Integer: 1 (true) if an integer, 0 (false) if not an integer

Examples

<?
  $x=1;
  print(is_int($x)); // outputs 1, $x is an integer
  $y=1.0;
  print(is_int($y)); // outputs 0, $y is a float
  $z="1.0";
  print(is_int($z)); // outputs 0, $z is a string
?>

Notes

This function checks ONLY the type of the variable, not the data that it holds!

To test if a variable contains a number or is a numeric string (such as form input, which is always a string), you should use is_numeric().

See Also

is_float() - Check if a variable is a float

is_numeric() - Check if a value is numeric (int, float or numeric string)

is_string() - Check if a variable is a string

is_array() - Check if a variable is an array

isset() - Check if a variable exists

uPHP Variable Types and Limits

uphp/functions/is_int.txt · Last modified: 2021/09/13 05:57 (external edit)