/** * Number format integers only, any other string will be returned as is * * @param mixed $number The number being formatted. * @param int $decimals [optional] Sets the number of decimal points. * @param string $decPoint [optional] * @param string $thousandsSep [optional] * @param bool $forceInt [optional] force the output to be cast to an int when a numeric value is not available * * @return string A formatted version of number. * * @deprecated */ function nformat($number, $decimals = 0, $decPoint = '.', $thousandsSep = ',', $forceInt = false) { return \Packaged\Helpers\Numbers::format($number, $decimals, $decPoint, $thousandsSep, $forceInt); }
public function testFormat() { $this->assertEquals('-', Numbers::format('-')); $this->assertEquals(0, Numbers::format('-', 0, '.', ',', true)); $this->assertEquals('10,000', Numbers::format('10000')); }