Any reason why printf() does not support formats with thousands separator?
| From: | Per Jessen | Date: | Mon, 10 Jul 2017 07:07:50 +0000 |
| Subject: | Any reason why printf() does not support formats with thousands separator? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-326131@lists.php.net to get a copy of this message | ||
$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().
--
Per Jessen, Zürich (19.9°C)
http://www.hostsuisse.com/ - virtual servers, made in
Switzerland.