PHP is_integer() Function

P
PHP is_iterable() Function
PHP is_int() Function

In this article, you will learn how to check if a variable is of type integer or not in PHP. The is_integer() function in PHP checks whether a variable is of type integer or not.

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

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

examples of the IS_INTEGER() function

Example 1. In this example, we 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>";
?>
PHP is_iterable() Function
PHP is_int() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z