Re: Re: number_format() = "-0.00"
| From: | Nikita Nefedov | Date: | Fri, 25 Nov 2016 19:42:11 +0000 |
| Subject: | Re: Re: number_format() = "-0.00" | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97191@lists.php.net to get a copy of this message | ||
> On 25 Nov 2016, at 21:07, David Rodrigues <david.proweb@gmail.com> wrote:
>
> As reference, I'll put here what some languages does on this case:
>
> Java: -0.00 (http://ideone.com/NOxen1)
> Python: -0.00 (http://ideone.com/llxGHA)
> Ruby: -0.00 (http://ideone.com/j3KgMd)
> C++14: -0.00 (http://ideone.com/P3WdoJ)
> Node.js: -0.00 (http://ideone.com/31gQgV - v0.12)
>
> C#: 0.00 (http://ideone.com/vW0F0b)
Hey,
You're comparing printf with number_format here. Even though both are formatting functions
they're not necessary of the same domain. (you can't really do what number_format does
with just a printf in a sane way (technically you can, but that depends on the locale and if you
were to change locale just to choose another separator that would be a bad idea))