matt
matt

Reputation: 726

Difference between is_int and is_integer php methods

which is the difference between the php methods:

is_int()

and

is_integer()

?

Thanks!

Upvotes: 27

Views: 10719

Answers (3)

Krucamper
Krucamper

Reputation: 371

is_integer — Alias of is_int()

is_int — Find whether the type of a variable is integer

Integers can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation, optionally preceded by a sign (- or +).

Upvotes: 7

salathe
salathe

Reputation: 51950

There is no difference, both is_int() and is_integer() are aliases of the is_long() function.

(This is one occasion where the documentation and source code diverge.)


The relevant function entry and alias declarations can be seen in the PHP source code (e.g. in PHP 5.4) like (reformatted for clarity):

PHP_FE(is_long, arginfo_is_long)

PHP_FALIAS(is_int, is_long, arginfo_is_long)

PHP_FALIAS(is_integer, is_long, arginfo_is_long)

Upvotes: 15

user142162
user142162

Reputation:

There is none. is_integer is an alias of is_int, as stated on the documentation page for is_integer:

is_integer — Alias of is_int()

Upvotes: 29

Related Questions