4 ms·
> But yes, all strings are truthy. Except an empty string! And maybe some little-used nullish characters? Doubtful, but... Or "0"
by zerocrates 6y ago
> But yes, all strings are truthy. Except an empty string! And maybe some little-used nullish characters? Doubtful, but...
Or "0"
- timw4mail 6y agoBut not in PHP 8
- zerocrates 6y agoThey changed a lot of the weirder string conversion stuff in PHP 8, but I'm pretty sure "0" is still falsy.
- hunter2_ 6y agohttp://sandbox.onlinephpfunctions.com/code/d6df91536669985a6502c2aeb2362722005e608d http://sandbox.onlinephpfunctions.com/code/d6df91536669985a6... Set it to PHP 8 and click "Execute code," then set it to PHP 7 and Execute again. They give the same result, which is that "0" is falsy in both versions.