# number_format bug fix

- Thread: https://externals.io/message/24304
- Original archive: https://news-web.php.net/php.internals/24304
- Started by Matt W on 2006-07-10T08:08:35+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #24304 — Matt W — 2006-07-10T08:08:35+00:00

URL: https://externals.io/message/24304#24304

Hi,

I was trying to enhance the functionality of `number_format()` (not finished,
as I think I need to ask about changes first :-)), and happened to notice
this bug while testing and saw it mentioned in a couple bug reports from
almost 2 years ago, but it hasn't been fixed.  Bug #29538, and it's also
mentioned at the end of #28228.  Where

number_format(1234, 2, '', ',')

returns 123,400 instead of the expected 1,23400

Happens when decimal places is > 0 with an empty decimal separator.  There's
a test with that criteria, but the thousands separator is also empty, which
hides the bug.

I was going to wait and include the fix with my proposed number_format
changes, but I was thinking you may want to patch this in 4.4.3 also (just
fixing the bug, since I know it doesn't get new features).  I don't know the
backporting "protocol" or if it's too late for 4.4.3, I just saw that Derick
wants to release it this month and wanted to ask.

I'll send a patch for all 3 branches if you want it, otherwise I'll just
wait...


Matt
