Skip to content
Related Articles
Open in App
Not now

Related Articles

PHP | is_int()

Improve Article
Save Article
Like Article
  • Last Updated : 21 Jun, 2019
Improve Article
Save Article
Like Article

is_int() is an inbuilt function in PHP. The is_int() function is used to test whether the type of the specified variable is an integer or not.

Syntax:

boolean is_int($variable_name)
Parameter: this function contains a single parameter 
$variable_name: the variable we want to check.
Return value : it is a boolean function so returns T
RUE when $variable_name is an integer, otherwise FALSE.




<?php
$variable_name1 = 56;
$variable_name2 = "xyz";
  
if (is_int($variable_name1))
{
    echo "$variable_name1 is Integer \n" ;
}
else
{
    echo "$variable_name1 is not an Integer \n" ;
}
if (is_int($variable_name2))
{
    echo "$variable_name2 is Integer \n" ;
}
else
{
    echo "$variable_name2 is not Integer \n" ;
}
?>

Output:

56 is Integer 
xyz is not Integer 

Reference:http://php.net/manual/en/function.is-int.php

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!