#44162 [Opn->Csd]: number_format() list incorrect optional parameters
| From: | rquadling@php.net | Date: | Tue, 19 Feb 2008 11:51:32 +0000 |
| Subject: | #44162 [Opn->Csd]: number_format() list incorrect optional parameters | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-529@lists.php.net to get a copy of this message | ||
ID: 44162
Updated by: rquadling@php.net
Reported By: me at edman007 dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: N/A
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Due to docbook not currently supporting a technique to group optional
parameters, a second description has been added.
Previous Comments:
------------------------------------------------------------------------
[2008-02-18 20:53:25] me at edman007 dot com
Description:
------------
on the number_format page (http://us2.php.net/number_format) the
parameters for it are listed as:
string number_format ( float $number [, int $decimals [, string
$dec_point ]], string $thousands_sep )
that is wrong, it suggests that when two parameters are given its
$number, $thousands_sep), its not, instead like most functions it works
left to right, with the exception that there is no valid form with three
parameters, that means it should look like this
string number_format ( float $number [, int $decimals [, string
$dec_point, string $thousands_sep]])
that would indicate that its one two, for 4 parameters
and to quote from the docs on this issue, 'All optional parameters are
seen in [ brackets ].'
(http://us2.php.net/manual/en/about.prototypes.php), $thousands_sep is
obviously optional but not in brackets
Reproduce code:
---------------
$a = 12345678.901;
echo number_format($a,2);
//12,345,678.90
//the prototype suggest this may be valid, though the docs below it say
its wrong
echo number_format($a, 2, 'x');
//PHP Warning: Wrong parameter count for number_format() in XXX- on
line 5
echo number_format($a, 2, '.', ',');
//12,345,678.90
//this is wrong, but according to the docs should be correct
echo number_format($a,' ');
//12,345,679
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44162&edit=1