method isDecimal documentation in bbn\Str

Checks if the item is a decimal.

Can take many arguments and it will return false if one of them is not a decimal or the string of a decimal (float).

Example

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; }

Checks if the item is a decimal. 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.