Added example with number_format.

Any other useful format may be added...


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@46794 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Damien Seguy 2001-05-07 09:13:26 +00:00
parent dc2e46bf89
commit 71c4c21cfe

View file

@ -842,6 +842,24 @@ $randval = mt_rand();
the decimals and <parameter>thousands_sep</parameter> instead of
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>
<programlisting role="php">
&lt;?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
?&gt;
</programlisting>
</informalexample>
</para>
</refsect1>
</refentry>