Re: Any reason why printf() does not support formats with thousands separator?
| From: | Per Jessen | Date: | Mon, 10 Jul 2017 14:40:21 +0000 |
| Subject: | Re: Any reason why printf() does not support formats with thousands separator? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326133@lists.php.net to get a copy of this message | ||
John Iliffe wrote:
On Monday 10 July 2017 03:07:50 Per Jessen wrote:That works, but doesn't do what I want - add thousands separators :-) /Per$SUBJ says it all - I've recently discovered that a format such as %'.2f" results in this: php -r "printf(\"%'.2f\", 23232323.237);" 23232323.237000 I know that number_format() will do the same, but I am given the format spec as an interface, I would need to try to parse it and then decide whether to use printf() or number_format().Try php -r "printf(\"%.2f\", 232323.4567);" 232323.46