mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
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:
parent
dc2e46bf89
commit
71c4c21cfe
1 changed files with 18 additions and 0 deletions
|
@ -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">
|
||||
<?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
|
||||
?>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue