[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-bugs
Subject:    [DOC-BUGS] #44162 [NEW]: number_format() list incorrect optional parameters
From:       "me at edman007 dot com" <doc-bugs () lists ! php ! net>
Date:       2008-02-18 20:53:25
Message-ID: bug-44162 () bugs ! php ! net
[Download RAW message or body]

From:             me at edman007 dot com
Operating system: N/A
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  number_format() list incorrect optional parameters

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 bug report at http://bugs.php.net/?id=44162&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44162&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44162&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44162&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44162&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=44162&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44162&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44162&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44162&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44162&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44162&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=44162&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=44162&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44162&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44162&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44162&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44162&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44162&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44162&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44162&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44162&r=mysqlcfg

-- 
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic