PHP is_int() Function

PHP is_integer() Function
PHP is_float() Function

In this article, you will learn how to check if a variable is of type integer or not in PHP. The is_int() function in PHP 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.

what is the syntax of the IS_INT() function in php?

is_int(variable);
ParameterDescription
variableRequired. Specifies the variable to check
PHP is_int() method

examples of the IS_INT() function

Example 1. In this example, we 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>";
?>
PHP is_integer() Function
PHP is_float() Function
en English
X
Scroll to Top