From 40f6a21d335b213f4d8a0aa8d841a349468d939a Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Tue, 26 Jun 2001 20:42:17 +0000 Subject: [PATCH] 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 --- functions/math.xml | 51 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/functions/math.xml b/functions/math.xml index 375520c15a..dbeadeee76 100644 --- a/functions/math.xml +++ b/functions/math.xml @@ -832,9 +832,9 @@ $randval = mt_rand(); string number_format float number - int decimals - string dec_point - string thousands_sep + int decimals + string dec_point + string thousands_sep @@ -860,23 +860,44 @@ $randval = mt_rand(); a comma (",") between every group of thousands. - For instance, French notation usually use two decimals, - comma (',') as decimal separator, and space (' ') as - thousand separator. This is achieved with this line : - + + <function>number_format</function> Example + + For instance, French notation usually use two decimals, + comma (',') as decimal separator, and space (' ') as + thousand separator. This is achieved with this line : + <?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 + ?> - + + + + See also: sprintf, + printf, sscanf and + fprintf. + +