Formats a number using php builtin number_format

@link http://php.net/manual/en/function.number-format.php

Expected params:
- number     number
- decimals   number|null (number of decimal places to render)

@return string
487109
public function numberFormat()
    {
        $num = (float) ((string) $this->getRequiredParameter('number'));
        $decimals = intval((string)$this->getParameter('decimals'));
        return number_format($num, $decimals);
    }
930225
public static function formatToNumber($value, $decimals = 2)
    {
        if (trim($value) != null) {
            return number_format($value, $decimals, '.', '');
        }
        return null;
    }
1268720
public function getFormat()
    {
        $result = null;

        foreach (static::$_formats as $value => $media_types)
        {
            $media_type = $this->getContentType();

            if (in_array($media_type, (array)$media_types))
            {
                $result = $value;
                break;
            }
        }

        return $result;
    }
249909
public function getTextFormat()
    {
        $args = func_get_args();
        if (count($args) == 2) {
            $pageNumber = $args[0];
            $fragmentNumber = $args[1];
        }
        if (count($args) == 3) {
            $pageNumber = $args[0];
            $fragmentNumber = $args[1];
            $segamentNumber = $args[2];
        }
        $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber .
            '/fragments/' . $fragmentNumber;
        if (isset($segamentNumber)) {
            $strURI .= '/segments/' . '/textformat';
        } else {
            $strURI .= '/textformat';
        }
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');

        $json = json_decode($responseStream);

        return $json->TextFormat;
    }
860836
public function formatSimple()
    {
        return number_format(
            $this->getValue(),
            $this->currency->getPrecision(),
            $this->currency->getDecimalMark(),
            $this->currency->getThousandsSeparator()
        );
    }
1168812
private function format()
    {
        $request_uri = sprintf('%s %s', $this->request->getMethod(), $this->request->getBasePath().$this->request->getPathInfo());

        $ret = [
            'meta' => [
                'api_version'   => $this->getVersion(),
                'request'       => $request_uri,
                'response_time' => $this->responseTime,
                'http_code'     => $this->code,
                'error_type'    => $this->errorType,
                'error_message' => $this->errorMessage,
                'error_details' => $this->errorDetails,
                'charset'       => 'UTF-8',
            ],
            'response'          => $this->data,
        ];

        switch ($this->responseType) {
            case self::FORMAT_JSON:
            default:
                return new JsonResponse($ret);
            case self::FORMAT_YAML:
                if ($ret['response'] instanceof \stdClass) {
                    $ret['response'] = [];
                }

                $dumper = new Dumper();

                return new Response($dumper->dump($ret, 8));
            case self::FORMAT_JSONP:
                $response = new JsonResponse($ret);
                $response->setCallback(trim($this->request->get('callback')));

                return $response;
                break;
        }
    }
211013
protected function getFormat()
    {
        if ($this->input->hasOption('format') && $this->input->getOption('format')) {
            return strtolower($this->input->getOption('format'));
        }

        return null;
    }
1031150
public function ordinal(): string
    {
        $abs = abs($this->number);

        switch ($abs % 10) {
            case 1:
                $ordinal = ($abs % 100 === 11) ? 'th' : 'st';
                break;
            case 2:
                $ordinal = ($abs % 100 === 12) ? 'th' : 'nd';
                break;
            case 3:
                $ordinal = ($abs % 100 === 13) ? 'th' : 'rd';
                break;
            default:
                $ordinal = 'th';
                break;
        }

        return $ordinal;
    }
823488
private function attemptToChooseFormattingPattern()
    {
        // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
        // number (excluding national prefix) have been entered.
        if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) {
            $this->getAvailableFormats($this->nationalNumber);
            // See if the accrued digits can be formatted properly already.
            $formattedNumber = $this->attemptToFormatAccruedDigits();
            if (mb_strlen($formattedNumber) > 0) {
                return $formattedNumber;
            }
            return $this->maybeCreateNewTemplate() ? $this->inputAccruedNationalNumber() : $this->accruedInput;
        }

        return $this->appendNationalNumber($this->nationalNumber);
    }
72718
public function number(): string
    {
        $num = gmp_import($this->_flags, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
        $last_octet_bits = $this->_width % 8;
        $unused_bits = $last_octet_bits ? 8 - $last_octet_bits : 0;
        $num >>= $unused_bits;
        return gmp_strval($num, 10);
    }
1224532
public function format(string $format = null, int $numbers = null)
    {
        $numbers = $numbers === null ? static::getDefaultNumbers() : $numbers;
        $format = $format === null ? static::getToStringFormat() : $format;

        $formatArray = str_split($format);
        $dateString = '';

        foreach ($formatArray as $key => $value)
        {
            if (key_exists($value, $this->values))
            {
                $dateString .= $this->values[$value];
                continue;
            }

            $dateString .= $value;
        }

        if ($numbers === static::INDIAN_NUMBERS)
        {
            $dateString = str_replace($this->arabicNumbers, $this->indianNumbers, $dateString);
        }

        return $dateString;
    }
4750
protected function number($number) {
        if (trim($number) === '') {
            return '';
        }
        $numbertext = '';
        if (trim($number) === 'i') {
            $numbertext = get_string('information', 'question');
        } else {
            $numbertext = get_string('questionx', 'question',
                    html_writer::tag('span', $number, array('class' => 'qno')));
        }
        return html_writer::tag('h3', $numbertext, array('class' => 'no'));
    }
643398
protected function num($n)
    {
        if (!is_numeric($n)) {
            return $n;
        }
        $broken_number = explode('.', (string)$n);
        if (isset($broken_number[1])) {
            return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1];
        }
        return number_format($broken_number[0], 0, ',', '.');
    }
224089
public function toString()
    {
        if ($this->isEmpty()) {
            return '';
        }

        $tabulationFormatted = $this->getTabulationFormatted();

        $string = '{' . PHP_EOL;
        $string .= $this->toStringMethods();
        $string .= $tabulationFormatted . '}';
        return $string . PHP_EOL;
    }
401434
public function formatNumber($value)
	{
		return number_format($value,$this->numberFormat['decimals'],$this->numberFormat['decimalSeparator'],$this->numberFormat['thousandSeparator']);
	}
875341
public static function formatToDecimal($value, $decimals = 2)
    {
        if (trim($value) != null) {
            return number_format($value, $decimals, '.', '');
        }
        return null;
    }
1142080
public static function php_number_format($number)
    {

        preg_match('/[.,](\d+)$/', $number, $matches);

        $num_decimals = strlen($matches[1]);

        return preg_replace('/[.,]/', '', $number) / pow(10, $num_decimals);
    }