335
and people wonder why we say PHP is a meme
(lemmy.world)
Post funny things about programming here! (Or just rant about your favourite programming language.)
The fault is the programmer for not using a switch statement.
"php doesn't stop me from coding like a moron, therefore php sucks"
I say that php breaks math entirely, and is therefore bad. "" == null returns true null == [] returns true "" == [] returns false.
In more recent versions it gets worse, because it has 0 == "any text" return true, "any text" == true return true, and 1 == true return true So indirectly 1 = 0, and now math is more directly broken.
If you're trying to directly compare different variable types in any language without strong typing, you're going to have edge-case results which you might not expect.
My "coding like a moron" message still stands. PHP isn't a strongly typed language and it doesn't tell you off for trying stupid stuff like comparing a string with an int. Nor do other languages like JavaScript.
Also using duck typing fails against php is pretty funny when it’s being compared against JAVASCRIPT of all things.