Re: Stricter implicit boolean coercions
| From: | Andreas Leathley | Date: | Wed, 27 Apr 2022 11:59:11 +0000 |
| Subject: | Re: Stricter implicit boolean coercions | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117635@lists.php.net to get a copy of this message | ||
On 26.04.22 16:36, Rowan Tommins wrote:
On 26/04/2022 14:53, Andreas Leathley wrote:value is specified. That might make it another sensible value to accept for implicit bool conversion, even though I am not sure how many checkboxes are used without setting an explicit value, but it could be considered an established value, especially with how commonplace HTML forms and checkboxes are in PHP applications.'on' is only true by "accident" though, because it is a non-empty string, not because of its meaning, and then it is likely that the value 'off' could also be added at some point - which also would be true.The reason I gave that particular example is that it's the default submission value for an HTML checkbox when checked; if it's not checked, it has no value at all (not even an empty string), so in that particular context there is no corresponding "off". Interesting, I didn't know the default value of a checkbox is "on" if no