mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
number_format:
- added optional tags to optional parameters - tweaked and added more examples - moved example description under example block - added "See also:" section - removed several manual annotations that were no longer needed because of these changes git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@50235 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
b6055685d0
commit
40f6a21d33
1 changed files with 36 additions and 15 deletions
|
@ -832,9 +832,9 @@ $randval = mt_rand();
|
|||
<funcprototype>
|
||||
<funcdef>string <function>number_format</function></funcdef>
|
||||
<paramdef>float <parameter>number</parameter></paramdef>
|
||||
<paramdef>int <parameter>decimals</parameter></paramdef>
|
||||
<paramdef>string <parameter>dec_point</parameter></paramdef>
|
||||
<paramdef>string <parameter>thousands_sep</parameter></paramdef>
|
||||
<paramdef>int <parameter><optional>decimals</optional></parameter></paramdef>
|
||||
<paramdef>string <parameter><optional>dec_point</optional></parameter></paramdef>
|
||||
<paramdef>string <parameter><optional>thousands_sep</optional></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
|
@ -860,23 +860,44 @@ $randval = mt_rand();
|
|||
a comma (",") between every group of thousands.
|
||||
</para>
|
||||
<para>
|
||||
For instance, French notation usually use two decimals,
|
||||
comma (',') as decimal separator, and space (' ') as
|
||||
thousand separator. This is achieved with this line :
|
||||
<informalexample>
|
||||
<example>
|
||||
<title><function>number_format</function> Example</title>
|
||||
<para>
|
||||
For instance, French notation usually use two decimals,
|
||||
comma (',') as decimal separator, and space (' ') as
|
||||
thousand separator. This is achieved with this line :
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<?php
|
||||
$nombre = 1234.56;
|
||||
// english notation (default)
|
||||
$english_format_number = number_format($nombre);
|
||||
// 1,234.56
|
||||
// French notation
|
||||
$nombre_format_francais = number_format($nombre, 2, ',', ' ');
|
||||
// 1 234,56
|
||||
|
||||
$number = 1234.56;
|
||||
|
||||
// english notation (default)
|
||||
$english_format_number = number_format($number);
|
||||
// 1,234.56
|
||||
|
||||
// French notation
|
||||
$nombre_format_francais = number_format($number, 2, ',', ' ');
|
||||
// 1 234,56
|
||||
|
||||
|
||||
$number = 1234.5678;
|
||||
|
||||
// english notation without thousands seperator
|
||||
$english_format_number = number_format($number, 2, '.', '');
|
||||
// 1234.56
|
||||
|
||||
?>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
See also: <function>sprintf</function>,
|
||||
<function>printf</function>, <function>sscanf</function> and
|
||||
<function>fprintf</function>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue