is_int()


bool is_int ( mixed $var )

Description

is_int() checks whether a variable is an integer or not.

※ available F/W version : all

Parameters

Return values

Returns TRUE if $var is an integer, otherwise FALSE.

Example

<?php
$val1 = 100;
$val2 = 100.0;

$ret1 = is_int($val1);
$ret2 = is_int($val2);

if($ret1) echo "ret1 is an int\r\n";  // OUTPUT: ret1 is an int
else echo "ret1 is NOT an int\r\n";

if($ret2) echo "ret2 is an int\r\n";
else echo "ret2 is NOT an int\r\n";  // OUTPUT: ret2 is NOT an int
?>

See also

is_array() / is_bool() / is_float() / is_string()

Remarks

This function is identical to the PHP group’s is_int().