Re: Re: Stricter implicit boolean coercions

From: Date: Tue, 26 Apr 2022 10:23:50 +0000
Subject: Re: Re: Stricter implicit boolean coercions
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-117610@lists.php.net to get a copy of this message
On 26.04.22 12:02, Mark Randall wrote:
On 26/04/2022 10:54, Andreas Leathley wrote:
Any non-empty string (except "0") is converted to true and any non-zero integer or float is converted to true.
If we could get rid of "0" being false, that alone would be a huge benefit for the language in the long run. I know why it exists, but I don't think it should. In fact it never should have existed in the first place. For me, highlighting all the places where a possibly unintended
conversion to true is happening would make "0" a lot less bad. "0.0" being silently true while "0" and 0.0 is false seems a bit awkward.

« previous php.internals (#117610) next »