[opensuse] php printf with thousands separator?
Does anyone know why PHP printf() does not (apparently) support the ' (single quote) to indicate a number format with thousands separator? -- Per Jessen, Zürich (25.4°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Per Jessen wrote:
Does anyone know why PHP printf() does not (apparently) support the ' (single quote) to indicate a number format with thousands separator?
This is the printf() format (for instance): "%'.2f". This works fine in C and with bash:printf, but somehow not in php. I was just wondering why that might be? -- Per Jessen, Zürich (26.5°C) http://www.cloudsuisse.com/ - your owncloud, hosted in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Op vrijdag 7 juli 2017 11:51:33 CEST schreef Per Jessen:
Per Jessen wrote:
Does anyone know why PHP printf() does not (apparently) support the ' (single quote) to indicate a number format with thousands separator?
This is the printf() format (for instance): "%'.2f". This works fine in C and with bash:printf, but somehow not in php. I was just wondering why that might be?
No idea why, but I mostly use number_format(..), see http://php.net/manual/en/function.number-format.php -- Gertjan Lettink, a.k.a. Knurpht openSUSE Board Member openSUSE Forums Team -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Knurpht - Gertjan Lettink wrote:
Op vrijdag 7 juli 2017 11:51:33 CEST schreef Per Jessen:
Per Jessen wrote:
Does anyone know why PHP printf() does not (apparently) support the ' (single quote) to indicate a number format with thousands separator?
This is the printf() format (for instance): "%'.2f". This works fine in C and with bash:printf, but somehow not in php. I was just wondering why that might be?
No idea why, but I mostly use number_format(..), see http://php.net/manual/en/function.number-format.php
Yeah, that's my googling kept tellme too. That won't work though - the patterns are given to me as fields from a 3rd party. They have to work with printf(), that is the only limitation. When I call printf() in php, I expect(ed) it to work with all the patterns from from C. If I were to use number_format(), it won't work with "%.2f". -- Per Jessen, Zürich (28.9°C) http://www.cloudsuisse.com/ - your owncloud, hosted in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Knurpht - Gertjan Lettink
-
Per Jessen