• PHP Video Tutorials

PHP - is_integer() Function


Advertisements

Definition and Usage

The function is_integer() checks whether the type of a variable is integer. This function is an alias of is_int().

Syntax

bool is_integer ( mixed $value )

Parameters

Sr.No Parameter & Description
1

value

The variable whose type is being evaluated.

Return Values

This function returns true if value is an int, false otherwise.

Dependencies

PHP 4 and above

Example

Following example demonstrates return values with different types of variables −

<?php
   $a = 33;
   echo "a is "; var_dump(is_integer($a)); echo "<br>";

   $b = "33";
   echo "b is "; var_dump(is_integer($b)); echo "<br>";

   $c = 33.5;
   echo "c is "; var_dump(is_integer($c)); echo "<br>";

   $d = "33.5";
   echo "d is "; var_dump(is_integer($d)); echo "<br>";

   $e = true;
   echo "e is "; var_dump(is_integer($e)); echo "<br>";

   $f = false;
   echo "f is "; var_dump(is_integer($f)); echo "<br>";

   $g = null;
   echo "g is "; var_dump(is_integer($g)); echo "<br>";
?>

Output

This will produce following result −

a is bool(true)
b is bool(false)
c is bool(false)
d is bool(false)
e is bool(false)
f is bool(false)
g is bool(false)
php_variable_handling_functions.htm

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements