logoalt Hacker News

usernametaken29today at 12:54 AM2 repliesview on HN

“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


Replies

DJBunniestoday at 1:29 AM

You'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.

wesammikhailtoday at 1:00 AM

if("false" === true) echo "PHP sucks";

else echo "You're full of shit!";

// output

> You're full of shit!