PHP is_integer() Function
❮ PHP Variable Handling Reference
Example
Check whether a variable is of type integer or not:
<?php
$a = 32;
echo "a is " . is_integer($a) . "<br>";
$b = 0;
echo "b is "
. is_integer($b) . "<br>";
$c = 32.5;
echo "c is " . is_integer($c) . "<br>";
$d = "32";
echo "d is " . is_integer($d) . "<br>";
$e = true;
echo "e is " . is_integer($e) . "<br>";
$f = "null";
echo "f is " .
is_integer($f) . "<br>";
?>
Try it Yourself »
Definition and Usage
The is_integer() function checks whether a variable is of type integer or not.
This function is an alias of is_int().
Syntax
is_integer(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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.