this post was submitted on 14 Jul 2023
339 points (90.6% liked)

Programmer Humor

32396 readers
497 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] cupcakezealot@lemmy.blahaj.zone 49 points 1 year ago (9 children)

The fault is the programmer for not using a switch statement.

[–] thatwill@lemmy.world 51 points 1 year ago (8 children)

"php doesn't stop me from coding like a moron, therefore php sucks"

[–] bastian_5@sh.itjust.works 1 points 1 year ago (4 children)

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.

[–] thatwill@lemmy.world 13 points 1 year ago (1 children)

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.

[–] kimpilled@infosec.pub 4 points 1 year ago

Also using duck typing fails against php is pretty funny when it’s being compared against JAVASCRIPT of all things.

load more comments (2 replies)
load more comments (5 replies)
load more comments (5 replies)