PHP is_int() Function
❮ PHP Variable Handling Reference
Example
Check whether a variable is of type integer or not:
<?php
$a = 32;
echo "a is " . is_int($a) . "<br>";
$b = 0;
echo "b is "
. is_int($b) . "<br>";
$c = 32.5;
echo "c is " . is_int($c) . "<br>";
$d = "32";
echo "d is " . is_int($d) . "<br>";
$e = true;
echo "e is " . is_int($e) . "<br>";
$f = "null";
echo "f is " .
is_int($f) . "<br>";
?>
Try it Yourself »
Definition and Usage
The is_int() function checks whether a variable is of type integer or not.
This function returns true (1) if the variable is of type integer, otherwise it returns false.
Syntax
is_int(variable);
Parameter Values
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
Technical Details
Return Value: | TRUE if variable is an integer, FALSE otherwise |
---|---|
Return Type: | Boolean |
PHP Version: | 4.0+ |
❮ PHP Variable Handling Reference