On 26.12.2018 at 16:47, Christoph M. Becker wrote: > Regarding the decimal separator (aka. decimal point), the behavior of > casting float to string is inconsistent with casting string to float. > While the former regards the current locale, the latter always expects a > decimal point regardless of the locale. This breaks round-trips for > locales which use something else than a dot as decimal separator (e.g. > German, which uses a comma), for instance: > > $float = 1/3; // float(0,33333333333333) > $string = (string) $float; // string(16) "0,33333333333333" > $float = (float) $string; // float(0)
Well, there's a special case, though: $string = (1/3) . 'foo'; // string(19) "0.33333333333333foo" This is caused by a compile-time optimization, which obviously occurs before any locale *can* be set. -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php