Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP is_int(), is_integer(), is_long() Functions

PHP is_int(), is_integer(), is_long() Functions

PHP Available FunctionsAvailable PHP Functions

is_int() The function is used to check whether a variable is an integer.

**Note:** To test whether a variable is a number or numeric string (such as form input, which is usually a string), you must use is_numeric().

Alias functions():is_integer(), is_long() .

PHP version requirement: PHP 4, PHP 5, PHP 7

Syntax


bool is_int ( mixed $var )

Parameter Description:

Return Value

If the specified variable is an integer, returns TRUE; otherwise returns FALSE.

Example

Example

The output is:


678 是整数
a678 不是整数
bool(false)
[ 678 是整数吗? ]
bool(true)
[ 999 是整数吗? ]
bool(false)
[ 698.99 是整数吗? ]
bool(false)
[ Array 是整数吗? ]
bool(false)
[ 125689.66 是整数吗? ]

PHP Available FunctionsAvailable PHP Functions