Defending PHP, The OG Of The Web Era

November 22, 2022

Defending PHP, The OG Of The Web Era

“PHP is a bad, failing language. It’s a piece of shit and it's ugly and it’s old and you’re a loser if you use it...”

Yes, well, maybe. Maybe not. Maybe get off that high horse and look PHP in the eyes. Then again, stay on that horse because you'll need the height. PHP stands tall and won’t stoop to your level. Well, it can, because PHP is pretty damn flexible. Yes, it has flaws and issues. Yes, it's not as slick and sexy as newer languages. And yes, many programmers hate it.

But programmers can argue about the right brand of coffee all day. If you want to know what programmers think about coffee, don’t ask them – check the brand they buy. Just check the stats if you want to see what the world really thinks about PHP. It’s still enormously popular and set to stay for a long time. As one Quora pundit remarked on yet another 'Is PHP dead?' question: “We can say, ‘Will X language die in 2030?’, where X is any language but not PHP.”

The problems with PHP

PHP’s detractors have a point – it is a problematic language. Many people love to jump on that bandwagon. They’re often wrong, but let's unpack their grievances because there are some valid criticisms.

PHP is definitely imperfect. It started in the Nineties as a set of scripting tools that were eventually cobbled into a framework. We can say PHP fakes it until it makes it, adding what it needs when needed. The result is often sloppy syntax and bad code, and many programmers have spent long nights fixing PHP projects. That will create resentment – especially since PHP is easy to learn but hard to master.

The language is open source – that gives PHP plenty of advantages, but also some security concerns. Being open source, anyone can look into PHP and find flaws to exploit. Combine this with the tendency for bad code, and I can appreciate that PHP has gifted many programmers with ulcers and premature grey hairs.

Yet the number one reason why people hate PHP is because it's fashionable to do so. These days, a programmer has to know several languages, one of which is PHP. It must be annoying for a young programmer to use an old language that looks wonky and poorly designed compared to newer peers. When the newbies hear the old pros bitch and moan about PHP, they adopt the same view without appreciating the language’s splendour.

Let me set that right. If you hate PHP because everyone else does, you need some perspective.

PHP is awesome

PHP is a flexible language with tons of bad habits, but it’s what makes PHP such a great choice for small projects or quick hacks. If you want to use Laravel and write code the way it wants, do it. If you want to use Zend Framework and write code this way, go right ahead. Or if you want to go against all frameworks, conventions and standards and write your own thing, PHP won't complain. PHP is a live-and-let-live language.

It is the language of choice for web applications of all sizes, from startups to established corporations. W3Techs estimates that 77.5% of websites use PHP. Wikipedia, Slack, Facebook, Etsy, Cloudflare, Tesla, Mailchimp, and Spotify – all these websites run in PHP. WordPress, Drupal, Joomla and MediaWiki rely on PHP. If you’re wondering, “Why must I learn PHP?”, it’s the backbone of most web tech. Even if you work with other languages, chances are good you’ll need to interact with or convert PHP code at some point.

Why do I love PHP? It just works. PHP is a robust language and compatible with most web server types – scalable, secure and easy to use. PHP is incredibly powerful and efficient, making it a perfect tool for any web application. It has many frameworks, extensive documentation and wonderfully creative solutions.

Learn to love PHP

If PHP was so bad and outdated, we’d have left it behind long ago. If PHP just stayed for legacy’s sake, it wouldn’t be so dominant. Enough developers loathe the language and would have phased it out by now. But they haven’t because they can’t. It's just too good at what it does. Yes, it’s sloppy, promotes bad code, and has other issues. Yet PHP lives on, evolving and dominating the web.

Why do people hate PHP? If you’re a veteran programmer who has spent so much time fixing PHP code, I feel you. Your pain is justified. But everyone else should take a moment and collect themselves. You are hating on the OG language that helped build the web and continues to form its backbone. You’re picking a fight you won't win.

If your project does need to scale and be robust and flexible, then PHP might be what you need. And if you hate PHP because everyone else does, you’re the one thing no programmer wants to be: someone who doesn’t know what they’re talking about.

Jacques Fourie

Gerrit Vermulen

Web Developer

Swipe iX Newsletter

Subscribe to our email newsletter for useful tips and valuable resources, sent out monthly.