You are here : phpstringnumber_format

number_format() - string

This function accepts either one, two, or four parameters (not three):
Parameters :
  • number - The number being formatted.
  • decimals - Sets the number of decimal points.
  • dec_point - Sets the separator for the decimal point.
  • thousands_sep - Sets the thousands separator.

  • Syntax

    string number_format
        ( float $number
       [, int $decimals = 0
      ] )


    Example

    For instance, French notation usually use two decimals,
         comma (',') as decimal separator, and space (' ') as
         thousand separator. This is achieved with this line :


    Output / Return Value


    Limitations


    Alternatives / See Also


    Reference