RE: [PHP-DEV] A different user perspective on scalar type declarations
| From: | François Laupretre | Date: | Fri, 27 Feb 2015 01:29:39 +0000 |
| Subject: | RE: [PHP-DEV] A different user perspective on scalar type declarations | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83946@lists.php.net to get a copy of this message | ||
> De : Zeev Suraski [mailto:zeev@zend.com]
>
> Thanks a lot for the input! We'll reconsider accepting "1"/"0" as
> valid
> Booleans as the original proposal did.
Yes. Same conversion rules : empty string and "0" are false, all the rest is true.
For consistency reasons, we can extend the "0" case to accept leading zeroes and leading
and trailing blanks, as for a numeric string.
Probably no need to go as far as common numeric string case, where "0.0" would be false
too, but to be discussed. The rule may be more intuitive if we say 'any numeric string that
converts to a null number is considered as false'.
Just a detail.
Regards
François