3 ms·
“false” === true because it’s not an empty string. It’s the same now that it used to be 10 years ago. The PHP equality operator is a meme, not even a joke
by usernametaken29 5mo ago
“false” === true because it’s not an empty string. It’s the same now that it used to be 10 years ago. The PHP equality operator is a meme, not even a joke
- wesammikhail 5mo agoif("false" === true) echo "PHP sucks"; else echo "You're full of shit!"; // output > You're full of shit!
- DJBunnies 5mo agoYou're thinking of == which type coerces the non-empty string to boolean true. PHP is not the only language that has this type of behavior.
- usernametaken29 5mo agoIt’s not the only language but it’s notorious for having the worst equality operator to the point where you are not even supposed to use == because it’s that awful