[PHP-DEV] Re: Inconsistent float to string vs. string to float casting

2018-12-27 Thread Umberto Salsi
cmbecke...@gmx.de ("Christoph M. Becker") wrote: > Hi! > > Regarding the decimal separator (aka. decimal point), the behavior of > casting float to string is inconsistent with casting string to float. > [...] I'm shocked... Lot of code here assumes (float) does the exact reverse of (string); foru

Re: [PHP-DEV] [RFC][Vote] Covariant Returns and Contravariant Parameters

2018-12-27 Thread Levi Morrison
> 2. But this test misses warning > > > $q = 1; > if ($q) { > class C {} > class D {} > } > > class A { > function bar(C $c) {} > } > class B extends A { > function bar(D $D) { > echo "ok\n"; > } > } > ?> The code detects this as an error bu

[PHP-DEV] Re: Inconsistent float to string vs. string to float casting

2018-12-27 Thread Christoph M. Becker
On 27.12.2018 at 17:33, Umberto Salsi wrote: > cmbecke...@gmx.de ("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. >> [...] > > I'm shocked... Lot of code here assumes

[PHP-DEV] Re: Inconsistent float to string vs. string to float casting

2018-12-27 Thread Christoph M. Becker
On 27.12.2018 at 18:57, Christoph M. Becker wrote: > […] filter_var() with > FILTER_VALIDATE_FLOAT can also be used, and might be the best option if > you don't know which decimal separator is used, and you are sure there > are no thousands separators in the string. No, that doesn't work, since t