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.
- Can you use the same rendering logic on client and server like JavaScript?
- Does it have the performance of Java or C# or Go?
- Does it allow for expressive DSLs like Ruby?
- Does it have an extensive, cutting edge ML ecosystem like Python?
Back in 2010, PHP's stand out features were very straightforward installation, good support for templating, and a large collection of C library wrappers (even if the interfaces were a bit raw). Those hooks were compelling enough to make people put up with the PHP4 core language.
But other languages have caught up on those three points, which leaves modern PHP utterly unremarkable. It doesn't have any feature that stands out enough to make me want to switch back.
- Yes there is LLVM for example
- Have you heard of Laravel ?
- No, there is already python for that, use the right tool for the right job
Today PHP is a really really good language to get scalable apps up and running, moreover with frameworks like laravle that comes with tons of batteries included without tanking the performances. But so so many people remains on the good old PHP dead trend just because it's easier to ignore all the great evolutions pf the past decades
Had this at my last job where I wrote PHP full time for two years. There were so many bugs caused by things that PHP has since remedied. I updated everything we could and it was huge step up (the available linting and static analysis tools are very solid), but there's still some deep, dark legacy code there that no one wanted to touch. Hell, a good part of my problem with that code base was actually because of Apache and mod_php.
If you have a fresh PHP code base, it's not that bad anymore. It wouldn't be my first pick, but definitely not my last.
Edit: I never got to work with Laravel, but I've played around independently and read their docs and it seems like a good dev experience.
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.
To answer your question, I don’t know that modern PHP has big advantages over other modern languages. I’m not knocking on doors to spread the gospel of Symfony. But there’s no need to switch away from it either. And hosting is still easy and cheap. Prototyping your product as a Laravel or Symfony app is a reasonable choice.
Last I used Php (v4 to v8), it had type hinting, which was fine but I think its going to become harder for newcomers to approach as there stronger and stronger types, which is what made Php so special to begin with IMHO.
It was typical PHP mix of HTML and PHP code in one file, an unreadable sequence of several crazy long HTML lines, then several lines of PHP code, then again HTML.
Lots of copy paste.
SQL statements were created by concatenation of user input with the text of the query. In 2018.
Back then I promised I'll never ever touch any PHP code. Live pretty much happily since then. I know there's some typing added to the language and other modern features. Still pretty sure, that if I open any random PHP file from any random PHP project, I'll still find the same mess as ever before.
Which is probably because php isn’t the top choice for new web based projects anymore. I have nothing against modern php, but old php causes me lots of pain, and that’s the only php I’ve ever known!
I have recently had to delve in PHP and it was much better and more mature than what people painted it to be 10+ years ago.
A night and day difference.
Jira gave me the same experience. I hated it remembering the 2020 times, yet going back to it now...I actually liked it way more than the alternatives.
More seriously I picked php because it lets me get away without having to strictly define anything and just get away with fuzzy logic. I want to jump on the bed god damn it!
I think it was a huge mistake to allow mixing code and HTML. On the other hand, without this feature, PHP probably wouldn't become popular at all.
There was a lot of what people call modern PHP, basically just without the types. I'd say the PHP 4 days are the darker ages that most people reference, but maybe your experience in 2012 was like 2007ish. (TLDR: If you found it fine in 2012 it's probably still fine in 2025, but I don't see the huge wins. I stopped using it for reasons other than "dislike").