is_long

bool is_long(mixed value) 

Tests whether a value is an integer.

Returns:

TRUE if the value is an integer; FALSE otherwise

Description:

is_long() checks whether value is an integer. If so, the function returns TRUE. If not, FALSE is returned.

Availability:

UNIX, Windows

Version:

3+, 4+

See also:

gettype() 

Example:

Test whether a value is an integer
 $value = 29.5 + 0.5; // Note that even though $value contains 30 it is still not an integer. // This is because the value of 30 was created by adding two doubles // ...making the resulting value a double as well if (is_long ($value)) print 'Value $value is an integer.'; else print 'Value $value is not an integer.'; $value = 30; // Now $value contains an integer if (is_long ($value)) print ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.