PHP Isn't Dead (It Just Stopped Being Cool)
Every year or so somebody declares PHP dead, and every year a huge chunk of the web keeps running on it anyway. WordPress, Wikipedia's MediaWiki, Drupal, a lot of the shops and forums and little business sites you use without thinking about it. Dead languages don't usually power that much stuff.
I get where the reputation came from. Old PHP was rough. The standard library had inconsistent function names and argument orders that you just had to memorize. Tutorials taught people to paste user input straight into SQL queries. Lots of code was one giant file mixing HTML, database calls and business logic, written by people who were learning as they went. If your last real look at PHP was a hosting control panel full of that kind of code, I understand the face you're making.
But the language you're picturing isn't the one people write today. Modern PHP has real type declarations for parameters, return values and properties. It has enums, readonly properties, named arguments, match expressions, arrow functions, and a proper object model. It got dramatically faster over the years, and there's a JIT compiler for the cases where that matters. Composer gives it a package manager that's honestly pleasant to use. PDO with prepared statements has been the standard way to talk to a database for a long time, so the SQL injection jokes are mostly about code that was outdated a decade ago.
The thing I like most about PHP, though, isn't any one feature. It's the deployment model. Each request starts fresh, runs your script, and throws everything away when it's done. There's no long-running process holding state that slowly leaks memory, no worrying about one request messing up another. You put files on a server with PHP-FPM and a web server in front, and it works. For a lot of small and medium projects that simplicity is worth more than whatever the trendy option offers.
It's also everywhere. Pretty much every shared host and server panel supports it out of the box. You don't need a build step, a container or a special platform to get a site live. That makes it a great fit for solo developers and small teams who'd rather ship than babysit infrastructure.
And if you do want structure, the frameworks are good. Laravel is genuinely nice to work in and has a big ecosystem around it. Symfony is solid and a lot of other projects build on its components. Or you can skip both and write plain PHP with a few Composer packages, which works better than people expect.
Is it the right tool for everything? No. If you're building something that needs lots of persistent connections, like a real-time chat server, a language built around long-running async processes is a more natural fit (though PHP has options there too). If your team already lives in JavaScript or Python, there's no reason to switch just to prove a point. And PHP still has some old quirks hanging around for backward compatibility.
My take: judge it by what it is now, not by code you saw in a forum post from years ago. Turn on strict types, use a static analyzer like PHPStan or Psalm, use prepared statements, and keep your logic out of your templates. Do that and PHP is a perfectly respectable, very productive language. Not cool. Just useful. I'll take useful.

Comments