It's time to stop hating on PHP, even though it kinda deserves it.

And that has ABSOLUTELY nothing to do with the fact that I'm starting a series of articles on a few recent and upcoming features of the language.

It's time to stop hating on PHP, even though it kinda deserves it.

PHP is probably one of the most hated programming languages in the world. And to be honest, there's a good reason for that. Wait, no, maybe I should say: there used to be a good reason for that. The language itself has come a long way since it's debut in 1994. Yes, 1994, the equivalent of the mesozoic era in the history of the internet.

Until a few years ago, it was an old and outdated scripting language. In fact, in its early days it wasn't even meant to be a real programming language at all. At least in the mind of its creator, Rasmus Lerdorf. Here's what he said about it:

I really don’t like programming. I built this tool to program less so that I could simply reuse code … I don’t know how to stop it, there was never any intention to write a programming language […]. I don’t know how to write a programming language at all, I just kept adding the next logical step.

If you're wondering how can a random programmer born in Greenland (!) unwillingly created one of the most influencial web technology of all time, well, it is still a little bit of a mistery. The thing is, despite it being a weird, flawed and inconsistent language, it was still better than the most - if not all - of the alternatives available at the time.

The Modern PHP

But is modern PHP the same language it used to be back in the day? Of course not, it got better and better after each release, and slowly became a pretty decent tool a lot of web developers started to use daily to develop modern and maintenable applications and websites. In fact, PHP currently powers more than 70% of the websites you can access from your web browser.

On the other end, that doesn't necessarily imply it has become the best solution available either. Despite the amazing and frequent improvements it has gone through, PHP still carries the signs of some of its old sins.

It may look like a meaningless example, but take a look at these functions:

str_replace("a", "b", $randomString); // replace part of a string

strtoupper($randomString); // make the string uppercase

ucfirst($randomString); // make the first letter of the string uppercase

This is a complete mess. All those function are related to strings, but they don't follow any predictable naming pattern. And even though this is just a silly example, it clearly shows how poorly the core of the language was designed. And in case you were wondering: yes, those functions are still used nowadays.

Most of the haters probably stopped caring for the language ages ago. They never experienced what it's like to build modern web applications with Symfony or Laravel, and maybe didn't even wrote a single line of PHP in the last decade. The language has evolved significantly since then, but nobody seems to care.

For most developers it is still the same language they were struggling with back in the PHP4 days. They completely ignore how PHP7 completely changed the face of the language and the following version, PHP8, made it even better. A lot of new highly-requested features made their way into the core. The Personal Home Page language (yes, that's the real original meaning of the acronym unfortunately, the whole HyperText Processor thing was probably just an attempt at making it sound cooler) is now a mature and all in all robust web development tool, with strong OOP capabilities and a fully-functional, albeit still optional, type system.

You may not like to hear this, but PHP is perfectly capable of producing modern and highly maintenable code in the right hands, and despite all its flaws, it's not going die or disappear anytime soon.

And this is one of the main reason I've decided to start a little series of articles explaining a few of the new stuff provided to us by PHP8 and everything that's coming with the upcoming 8.1 release.

Stay tuned for more exciting content related to the most active and influent dead language in the world.