Why we (still) use PHP

profile picture

Thomas Architect

26 Oct 2017  ·  4 min read

Recently, one of our (otherwise very satisfied) clients asked us: why do you still use an old-fashioned technology like PHP? Our Architect Thomas answers.

Saying PHP has a less-than-amazing reputation among developers is a serious understatement. A quick Google search on “php bad” returned 346 million results – that’s at least 20 times more than any other programming language I tried.

Arguably the most famous of those PHP-hate articles flat-out calls it “a fractal of bad design”, and goes to great lengths to describe every inconsistency, quirk, redundancy and other design mistake.

PHP’s rocky past

This lack of design consistency is easily explained by looking at PHP’s history. Other popular programming languages, like C#, Python and Ruby, were intentionally designed by extremely talented people with years of experience. PHP was basically hacked together as a scripting library around HTML, by a hobbyist-developer called Rasmus Lerdorf in 1994.

His Personal Home Page Tools quickly grew to immense popularity in the still very young and immature web development world of the nineties. The following years were marked by rewrites and feature additions, many of them developed by volunteers in their free time.

PHP wasn’t designed. It happened.

The next question would be: why did this ugly thing become so popular? Exactly because of its original hack-away philosophy: it provided a lot of functionality with a very low learning curve. Run an installer, open Notepad, write a few lines of code and BAM, instant gratification (even Ruby on Rails author DHH expressed his admiration for the immediacy of PHP).

For many people (including myself), PHP was one of the first steps into programming. And while its low learning curve is still one of the language’s main assets, it also led to an ever-expanding community of untrained developers, mostly unaware of things like code structure or design patterns.

Yes, a lot of horrible spaghetti-code was written. A lot.

Fast-forward to 2017

PHP holds a top 10 position in the TIOBE Programming Community Index, and even makes the top 3 in the PYPL index. Famous blogging platform Wordpress, which powers no less than 25% of all websites on the internet, including those of multiple Fortune 500 companies, is written in PHP. Facebook was originally written in PHP, and still uses a variant of it. Wikipedia? Written in PHP. Widely used CMS systems like Drupal, Joomla and Magento? Yup, PHP.

At this point, PHP is used by an estimated 80% of all websites online. That’s a pretty impressive number for a scripting language considered inferior by many.

Fortunately, the language has evolved massively since its first incarnation of 1995. Yes, a lot of its original quirks still exist. But both the language and its ecosystem have matured to a whole new level.

PHp and friends

It now has full support for the Object Oriented Programming paradigm and unicode, a great dependency manager, sensible coding standards, decent code analysis tools and testing frameworks, a true IDE experience and most importantly, some fantastic frameworks.

Members of the most popular PHP projects united their talents to design common coding interfaces.

And with the release of PHP version 7 in 2015, an enormous effort was made to make the language ready for the future: performance was doubled, exception handling finally made consistent and a lot of deprecated old features removed.

PHP’s architecture is very simple. Each HTTP request to the server is handled by starting up and then tearing down a new PHP instance. No persistent process, no persistent memory storage.

A very simple model indeed, and certainly not the most efficient one, but it matches almost perfectly to the request/response ideology of HTTP and makes it really easy to scale horizontally.

To conclude: while a great part of the original critique was absolutely true, much of the language’s pain points have been cured - either in the core language or by external tooling.

PHP at November Five

Every since its humble beginnings in 2009, November Five has been using PHP for server-side code. Originally, we built our own in-house framework, but as the complexity and requirements of our backend system started to grow, the decision was made to switch to Symfony, probably the leading PHP framework at this point.

In the course of almost 10 years, our serverside team has built a huge expertise using PHP, with tens of Symfony extensions, company-wide coding guidelines and standardized plug&play setups.

We known what the quirks are and how to overcome them. And all of our applications scale effortlessly.

Will we use PHP forever? Almost certainly not. In fact, a large part of our internal tools are written in Python, and many projects include Python or JavaScript based components. We monitor trends and evolutions in the developer universe. We regularly experiment with new frameworks and languages. After all, PHP is just a tool, not a solution.

When the time has come to change, we will be ready. Until then, we’re fine. And so are our customers.