Re: [PHP-DEV] Re: Stricter implicit boolean coercions

2022-04-26 Thread Andreas Leathley

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.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



[PHP-DEV] Re: Stricter implicit boolean coercions

2022-04-26 Thread Mark Randall

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.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php