@param string|float $number

@return string
331325
public static function normalizeNumber($number): string
    {
        $number = str_replace([',', ' '], ['.', ''], (string)$number);

        if (
            (($e = strrchr($number, 'e')) !== false) ||
            (($e = strrchr($number, 'E')) !== false)
        ) {
            $number = number_format((float)$number, -intval(substr($e, 1)));
        }

        return $number;
    }
995609
static function format_number($number) {
        $formatted = rtrim(format_float($number, 4),'0');
        if (substr($formatted, -1)==get_string('decsep', 'langconfig')) { //if last char is the decimal point
            $formatted .= '0';
        }
        return $formatted;
    }
1050927
private function getColorChar($number)
    {
        $modulo = $number % 22;

        if ($modulo < 10) {
            return strrev((string) $modulo);
        }

        $numberMap = array(
            10 => 'A',
            11 => 'B',
            12 => 'C',
            13 => 'D',
            14 => 'E'
        );

        if (isset($numberMap[$number])) {
            return strrev($numberMap[$number]);
        }

        $moduloMap = array(
            21 => 'A',
            20 => 'B',
            19 => 'C',
            18 => 'D',
            17 => 'E'
        );

        if (isset($moduloMap[$modulo])) {
            return strrev($moduloMap[$modulo]);
        }

        return strrev('F');
    }
908001
public function convertToDouble($number)
    {
        $number = str_replace(',', '.', (string) $number);

        if (!is_numeric($number)) {
            throw new \UnexpectedValueException("{$number} não é um número válido");
        }

        return (float) number_format($number, 2, '.', '');
    }
1261485
public function toRoman($number)
    {
        $number = (int)$number;
        $roman = '';
        foreach ($this->getRomanValues() as $romanValue => $numberValue) {
            $roman .= str_repeat($romanValue, floor($number / $numberValue));
            $number = $number % $numberValue;
        }
        foreach ($this->getRomanExceptions() as $replaceThis => $withThis) {
            $roman = str_replace($replaceThis, $withThis, $roman);
        }
        return $roman;
    }
485730
public static function fromString($number)
    {
        $decimalSeparatorPosition = strpos($number, '.');
        if ($decimalSeparatorPosition === false) {
            return new self($number, '');
        }

        return new self(
            substr($number, 0, $decimalSeparatorPosition),
            rtrim(substr($number, $decimalSeparatorPosition + 1), '0')
        );
    }
423007
public function transformToWords($number)
    {
        $units = $number % 10;
        $tens = (int) ($number / 10) % 10;
        $hundreds = (int) ($number / 100) % 10;
        $words = [];

        if ($hundreds > 0) {
            $words[] = $this->dictionary->getCorrespondingHundred($hundreds);
        }

        if ($tens !== 0 || $units !== 0) {
            $words[] = $this->getSubHundred($tens, $units);
        }

        return implode(' ', $words);
    }
1208725
public function number($number = null)
    {
        if ($number !== null) {
            $this->number = $this->escape($number);
            return $this;
        }
        return $this->number;
    }
841876
static function parseMobileNumber($number) {
    // Extract numerics
    $numerics = static::extractNumerics($number);
    // Set country code
    $countryCode = '';
    // Get last 10 digits
    $short = static::right($numerics, 10, $countryCode);
    // Set carrier code
    $carriercode = '';
    // Get number
    $number = static::right($short, 7, $carrierCode);
    // Return
    return compact('countryCode', 'carrierCode', 'number');
  }
990761
public function format($number, $options = [])
    {
        return $this->formatter()->format($number,
            $this->mergeOptions($options)
        );
    }
957395
public static function convert($number)
    {
        $number = preg_replace('/\,/i', '', $number);

        $number = preg_replace('/([^0-9\.\-])/i', '', $number);

        if (! is_numeric($number)) {
            return '0.00';
        }

        $isCents = (bool) preg_match('/^0.\d+$/', $number);

        return ($isCents ? '0' : null).number_format($number * 100., 0, '.', '');
    }
1303926
public function format($number) {
    if ((int) $number != $number) {
      throw new \InvalidArgumentException('Number has no valid integer value.');
    }
    $sign = (int) ($number < 0);
    $number = abs($number);
    $digits = str_split($number);
    $symbols = $this->cloneNumberPatternSymbols($this->symbols[$sign]);
    $this->process($symbols[$sign], $digits);
    $this->replacePlaceholders($symbols[$sign]);
    $output = '';
    foreach ($symbols[$sign] as $symbol) {
      $output .= !is_null($symbol->replacement) ? $symbol->replacement : $symbol->symbol;
    }

    return $output;
  }
1083564
protected function getListCharacter($number)
    {
        $listCharacter = $this->_prefix . $this->getNumber($number) . $this->_suffix;
        return PHPRtfLite::quoteRtfCode($listCharacter);
    }
172345
protected function modulo10($number)
    {
        $next = 0;
        for ($i=0; $i < strlen($number); $i++) {
            $next = $this->moduloTable[($next + intval(substr($number, $i, 1))) % 10];
        }

        return (10 - $next) % 10;
    }
265322
public static function formatSocialNumber($number){

		assert('is_integer($number)');

		if(!is_integer($number)) return $number;

		if($number > 10000000){

			$number = round($number / 1000000) . 'M';
		}
		elseif($number > 1000000){

			$number = round($number / 1000000, 1) . 'M';
		}
		elseif($number > 10000){

			$number = round($number / 1000) . 'K';
		}
		elseif($number > 1000){

			$number = round($number / 1000, 1) . 'K';
		}

		return $number;
	}
155930
public static function format($number, $decimals = 2, $decimalPoint = '.', $thousandSeparator = ',')
    {
        return number_format($number, $decimals, $decimalPoint, $thousandSeparator);
    }
988138
public function numberToRomanNumerals(int $number): string
    {
        if ($number < 1) {
            // Cannot convert zero/negative numbers
            return (string) $number;
        }
        $roman = '';
        foreach (self::ROMAN_NUMERALS as $key => $value) {
            while ($number >= $key) {
                $roman  .= $value;
                $number -= $key;
            }
        }

        return $roman;
    }