PHP is_int() function
Description
is_int(value) tells if a value is an integer.
Syntax
PHP is_int() function has the following syntax.
is_int(value)
Parameter
- value is the variable being type checked.
Return
PHP is_int() function returns true if value is an integer.
Example
Is it an integer value?
<?php/*from w w w . jav a 2 s .c o m*/
$values = array(2, "2", 2.5, "2.5", null, true);
foreach ($values as $value) {
echo "is_int(";
var_export($value);
echo ") = ";
var_dump(is_int($value));
}
?>
The code above generates the following result.