Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 public function testFormat()
 {
     $this->assertEquals('-', Numbers::format('-'));
     $this->assertEquals(0, Numbers::format('-', 0, '.', ',', true));
     $this->assertEquals('10,000', Numbers::format('10000'));
 }