- JavaScript-inspired methods
- Underscore.js-inspired methods
Determines whether the passed value is a finite number.
{mixed} $value- source
isFinite($source): bool<?php
$res = Numbers::isFinite(log(0)); // trueDetermines whether the passed value is an integer.
{mixed} $value- source
isInteger($source): bool<?php
$res = Numbers::isInteger(123); // trueDetermines whether the passed value is Not a Number.
{mixed} $value- source
isNaN($source): bool<?php
$res = Numbers::isNaN(\NAN); // trueParse source to a float
{mixed} $value- source
parseFloat($source)<?php
$src = "4.567abcdefgh";
echo Numbers::isNaN(Numbers::parseFloat($src)); // true<?php
$src = "abcdefgh";
echo Numbers::isNaN(Numbers::parseFloat($src)); // falseParse source to an integer
{mixed} $value- source
isInteger($source): bool<?php
$res = Numbers::parseInt("123"); // 123<?php
$res = Numbers::parseInt("0xF", 16); // 15<?php
$res = Numbers::parseInt("101110", 2); // 46<?php
$res = Numbers::parseInt("0xF", 2); // NaNFormats a number using fixed-point notation
{float} $value- source{int} $digits- (optional) the number of digits to appear after the decimal point; this may be a value between 0 and 20
toFixed(float $value, int $digits = 0): float<?php
$res = Numbers::toFixed(12345.6789, 1); // 12345.7<?php
$res = Numbers::toFixed(12345.6789, 6); // 12345.678900Returns a string representing the Number object to the specified precision.
{float} $value- source{int} $precision- (optional) an integer specifying the number of significant digits.
toPrecision(float $value, int $precision = null): float<?php
$res = Numbers::toPrecision(5.123456); // 5.123456<?php
$res = Numbers::toPrecision(5.123456, 5); // 5.1235<?php
$res = Numbers::toPrecision(5.123456, 2); // 5.1<?php
$res = Numbers::toPrecision(5.123456, 1); // 5Determines whether the passed value is a number.
{mixed} $value- source
isNumber($source): bool<?php
$res = Numbers::isNumber(1); // true<?php
$res = Numbers::isNumber(1.1); // trueReturns a wrapped object. Calling methods on this object will continue to return wrapped objects until value is called.
{number} $value- source
chain($value)