number() 공개 정적인 메소드

Formats a string by number_format().
또한 보기: http://www.php.net/manual/en/function.number-format.php
public static number ( string $value, array $format = [] ) : string
$value string Value
$format array Array with number of decimals, decimals point and thousands separator, default is `array(2, ',', ' ')`
리턴 string
예제 #1
0
 public function testNumber()
 {
     $value = 1336811080.23;
     $format = [];
     $this->assertEquals('1 336 811 080,23', rex_formatter::number($value, $format));
     $format = [5, ':', '`'];
     $this->assertEquals('1`336`811`080:23000', rex_formatter::number($value, $format));
 }
예제 #2
0
파일: timer.php 프로젝트: staabm/redaxo
 /**
  * Returns the formatted time difference.
  *
  * @param int $precision Factor which will be multiplied, for convertion into different units (e.g. 1000 for milli,...)
  * @param int $decimals  Number of decimals points
  *
  * @return string Formatted time difference
  */
 public function getFormattedDelta($precision = self::MILLISEC, $decimals = 3)
 {
     $time = $this->getDelta($precision);
     return rex_formatter::number($time, [$decimals]);
 }