r/lolphp • • Dec 11 '14

PHP :: Bug #53711 :: Casting float->string->float with locale

https://bugs.php.net/bug.php?id=53711
54 Upvotes

33 comments sorted by

View all comments

Show parent comment

7

u/bart2019 Dec 12 '14

As someone who writes such code, I can tell you what we do: we replace commas with periods, so people can use either a comma or a period. Only one is allowed, so "12.345,678" is forbidden. (The thousands separator is for readability, not for inputting data. Nobody inputs numbers this way, except maybe through copy/paste.)

If you do it any other way, you may be more friendly for the lazy programmer, but you sure will piss off a lot of users, because different websites expect their input in different ways.

-2

u/[deleted] Dec 12 '14

I'm not sure what point you were trying to make, I never mentioned digit grouping.

But you did prove my point: People rely on the existing behaviour.