Can take many arguments and it will return false if one of them is not a decimal or the string of a decimal (float).
X::dump(\bbn\Str::isDecimal(13.2));
// (bool) true
X::dump(\bbn\Str::isDecimal('13.2'));
// (bool) true
X::dump(\bbn\Str::isDecimal(14));
// (bool) false
function()
{
$args = \func_get_args();
foreach ($args as $a){
if (\is_string($a)) {
if (!preg_match('/^-?(\d*\.\d+)$/', $a)) {
return false;
}
}
elseif (!\is_float($a)) {
return false;
}
}
return true;
}