1010
PHP is dead? (telegra.ph)
submitted 8 months ago by sag@lemm.ee to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] mrbubblesort@kbin.social 113 points 8 months ago

People who say PHP is shit haven't really used it and are just repeating the memes. It's a perfectly fine language and there are a number of excellent tools and frameworks for it. It's reputation is a result of it's easy entry and widespread use. A whole lot of people who knew just enough to be dangerous made a whole lot of stuff, and it ended up causing a whole lot of problems. But for some reason devs shit on the language instead of shitting on the devs who put them in a mess.

[-] araozu@lemm.ee 14 points 8 months ago

I used to think that php was a bad language until recently (used php5 when i was just learning to program, cooked some delicious spaghetti). But after 5 years I had to use PHP at work. The language has improved a lot, but I think a lot of the bad parts are still there.

Like, why does stdclass exist? Why not just use associative arrays? Why are there warning, error, fatal errors, exceptions? Some functions throw exceptions, other raise errors, others return false, other fail silently and you have to call another function to check if there was an error (last_json_error). Why do find functions return false instead of -1? Like every other language? Why can't I use strings with numeric values as maps keys? (I can't have ["001" => value], it gets casted to ["1" => value].

There are no generics, you have to use mixed everywhere. The stdlib is an inconsistent mess, some_snake_case, someCamelCase, verb_noun, noun_verb, functions are not namespaced, everything is global. A lot of duplicates: die vs exit, print vs echo, etc. You are forced to use PSR & autoload to be able to use namespaces in a tolerable way, not including_once everywhere. No UTF-8 support, only ascii. You have to manually use mb_ functions. Variable scoping is weird. Variable variables? Why?

And all that is just comparing it to the average language. If compared to a modern language like Rust, Zig, Swift, php is light years behind.

It's not hot garbage, but I wouldn't call it "good". There's laravel, but not much more. PHP still makes you shoot yourself in the foot by default, unless you spend a lot of time learning its edge cases. Just like javascript.

load more comments (45 replies)
this post was submitted on 30 Oct 2023
1010 points (96.2% liked)

Programmer Humor

31314 readers
30 users here now

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

Rules:

founded 4 years ago
MODERATORS