Re: [PHP-DEV] [RFC] [DISCUSSION] Locale-independent float to string cast

This is only part of a thread. view whole thread
  109265
March 24, 2020 10:14 nikita.ppv@gmail.com (Nikita Popov)
On Tue, Mar 24, 2020 at 10:40 AM Máté Kocsis <kocsismate90@gmail.com> wrote:

> Hi Internals, > > Together with George, I'd like to propose an RFC for a long-standing > problem PHP has: > casting floats to string depends on the locale settings. As this behaviour > is nonsense, and > because it can cause quite serious problems, we would like to get rid of > locale-dependence > in PHP 8. > > Please find our RFC at > https://wiki.php.net/rfc/locale_independent_float_to_string. >
I'm obviously in favor of this proposal. Only really comment I have is on printf(): You're right that we have %f and %F to toggle locale-sensitivity, but the %e, %E, %g, %G formats are always locale-sensitive. It might make sense to introduce locale-insensitive variants of those, especially considering that %G is considered the "standard" floating point format. Internally we support %H for that, so we could expose that... (Alternatively, locale-sensitivity might be removed for e/E/g/G.) Regards, Nikita