• PHP Video Tutorials

PHP - is_long() Function



Definition and Usage

The function is_long() checks whether the type of a variable is integer.

Syntax

bool is_long ( 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_long($a)); echo "<br>";

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

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

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

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

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

   $g = null;
   echo "g is "; var_dump(is_long($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
Advertisements