Can take as many arguments and will return false if one of them is not an integer or the string of an integer.
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;
}