logoalt Hacker News

nasretdinovtoday at 4:08 PM2 repliesview on HN

if("0") {} being equivalent to if(false) {} still gives me nightmares even though I've stopped using PHP for at least 6 years now :)


Replies

moritzwarhiertoday at 4:16 PM

I knew this in and out, but as a Full-Stack PHP/Symfony/Frontend/JS guy who pivoted to mainly TS for b2b stuff, I still have to occasionally enter

  !""

into the browser console just to be sure, during code reviews :D
show 1 reply
kiftoday at 4:11 PM

Also `empty("0") === true` is a common gotcha.