←back to thread

123 points jonfelsar | 1 comments | | HN request time: 0s | source
Show context
ksenzee ◴[] No.45188438[source]
This is a preemptive plea for people who last wrote PHP in 2012 not to opine on what writing PHP is like in 2025. It is not a hammer with two claws. It’s a modern language with types and tooling and package management.
replies(11): >>45188723 #>>45188743 #>>45188884 #>>45188975 #>>45189013 #>>45189047 #>>45189096 #>>45189217 #>>45189290 #>>45194060 #>>45197489 #
ekidd ◴[] No.45188723[source]
I've certainly seem some lovely PHP code. Even phpBB has been very clean for a long time.

But at the same time, you run into the same problems that you often see with C++. Yes, there's a clean, semi-modern dialect of the language that has 80% of what you'd ideally want. And 80% is often more than enough for practical engineering purposes. But the actual project you get hired to work on may not be written in that cleaner, modern dialect. The last C++ project I cracked open had gone almost 20 years since its last serious update. It wasn't terrible. But wow, did it take a lot of very tricky code to accomplish anything before boost and TR1 became popular.

And old PHP was one of the worst languages ever invented: the core C code was hopelessly insecure (I had to read it for a client during the dotcom boom), the database APIs were different for every single database (and all of them made SQL injection techniques too easy), the default configuration allowed hostile users to inject global variable values using CGI parameters, and I could go on for a week. Yes, I saw some ugly stuff in other languages during the dotcom boom. But ancient PHP was often on a whole other level.

And when a language's history includes that much ugliness, you need to be very careful about old production code bases. Maybe you get a nice Symfony app! Buy maybe you get mixed HTML/PHP/SQL with a hundred security holes inherent in the APIs being used.

replies(2): >>45188885 #>>45199159 #
pavel_lishin ◴[] No.45188885[source]
Not to mention, the people who've been writing code in 2012 are still writing PHP code like it's 2012, and plenty of people are learning to write PHP the same way.

I haven't seen too many PHP codebases in the past decade, but every one has been full of a mix of commits that are beautiful, clean, functional code... and just the worst mishmash of garbage I've ever seen.

PHP might be fine, but I'm still not sure if I'm ready to work with other PHP developers.

replies(4): >>45189071 #>>45189350 #>>45190473 #>>45191050 #
1. trog ◴[] No.45191050[source]
you can replace the word "PHP" in this post with any other language and it would still be true.