method isInteger documentation in bbn\Str

Checks if the item is a integer.

Can take as many arguments and will return false if one of them is not an integer or the string of an integer.

Example

X::dump(\bbn\Str::isInteger(13.2)); // (bool) false X::dump(\bbn\Str::isInteger(14)); // (bool) true X::dump(\bbn\Str::isInteger('14')); // (bool) true function() { $args = \func_get_args(); foreach ($args as $a){ if (!is_string($a) && !is_int($a) && !is_float($a)) { return false; } if (is_float($a)) { $a = (string)$a; } if (is_string($a)) { if (!preg_match('/^-?(\d+)$/', (string)$a)) { return false; } } elseif (!\is_int($a)) { return false; } } return true; }

Checks if the item is a integer. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.