Function __global->number_format

Definitions

sources_custom/phpstub.php

  • Format a number with grouped thousands.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$number mixed No No required parameter N/A N/A The number to format [integer or float] (technically always float because it could be larger than an integer, but that's ugly)
$decimals integer No No 0 N/A N/A The number of decimal fraction digits to show
$dec_point string No No . N/A N/A The string to use as a decimal point
$thousands_sep string No No , N/A N/A The string to separate groups of 1000's with

Returns

  • The string formatted number
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Format a number with grouped thousands.
 *
 * @param  mixed $number The number to format [integer or float] (technically always float because it could be larger than an integer, but that's ugly)
 * @param  integer $decimals The number of decimal fraction digits to show
 * @param  string $dec_point The string to use as a decimal point
 * @param  string $thousands_sep The string to separate groups of 1000's with
 * @return string The string formatted number
 */

function number_format($number, int $decimals = 0, string $dec_point = '.', string $thousands_sep = ',') : string