Is PHP relevant?

One of the most common questions I’m asked by academees, applicants and even other developers, is, ‘why do you teach PHP?’ or, sometimes even, ‘isn’t PHP a dead language?’

Let me very clear about this from the start. PHP IS NOT DEAD.

As of December 2017, PHP makes up over 83% of server side languages used on the internet. Much of that is made up of PHP-based content management systems such as WordPress, but even if you remove pre-built CMS from the equation, PHP still makes up over 54% of the web. In fact, if you take a look at the graph below, you can see that the PHP market share was consistent throughout 2017, and has even increased.

Back in September I wrote a blog about ‘industry relevant’ skills and technologies. At the time of writing that blog, PHP and JavaScript were by far the most sought after languages in the job market. That remains the case. Not coincidentally, they’re the two languages we spend the most time on at the academy.

Let’s look at some of the usage stats around other languages, starting with the most popular ones being taught to new programmers. Universities tend to focus on Java and / or C, and as a result of this many new startups are choosing to build their applications in these languages. This means that Java now makes up about 2.5% of the web’s server side languages. With C nowhere to be seen, but ASP.NET – which is a web framework sometimes taught by universities – at 14.2%. Languages such as Python, Ruby and Server-side JavaScript are the most common focus of programming bootcamps, yet collectively these languages only cover 1.2% of the internet. Server-side JavaScript (Node.js) is currently the fastest growing server-side technology, and though still relatively small, it’s certainly one to be prepared for (and we currently dedicate a week’s learning time to Node.js in the academy curriculum).

Techrepublic recently published an article about the top languages to learn in 2018, with both PHP and JavaScript appearing in the top six, and with PHP moving from 9th to 6th in 2017.

So why do so many people claim PHP is an irrelevant or dead language?

There are two reasons as far as I can see. First, it’s sometimes a a legacy opinion passed down from developer to developer. When PHP was in its early years, it was a relatively slow language, with many inconsistencies and very little direction. The language has evolved a lot over the years however, and since PHP 5.3 was released in 2009, most of these old complaints have been fixed. The latest version (7.1) is an extremely fast, streamlined language with a strong OO focus.

Second, PHP is a very flexible, loosely typed language. This makes it very easy to pick up and start writing, but also very easy to write poorly. You could say that it’s a victim of its own success. But when written properly, following methodologies such as DRY, SOLID and MVC (all concepts we teach on the academy course), it is a very powerful, diverse and fast language with a lot to offer.

So no, PHP is not dead. While like any language, it has its flaws, the statistics really do speak for themselves.

83% of websites does not equal 83% of the Web as used. Looking at the methodology, sites are not weighted by Alexa rank,thus many small CMS sites based on the same PHP packages may be skewing the results.

I think it really depends on the work you are doing. If most of the team knows a language and can deliver the project effectively, that's the preferred way. Many developers may have had these experiences as well and not used PHP. This might explain the "Why should I be concerned with PHP if we didn't use it."

You've pointed out some great examples for those whom may not have used PHP in the past and are curious why it is still popular. Me personally, I'm coming back to PHP after years away, and love the new updates in 7.1.

PHP like JS is popular. No question about the fact that you can do great things in PHP and that great things have been done with it.
I appreciate all bootstrapping courses that teach programming.

That being said, your post does not demonstrate anything.

Saying “But when written properly, following methodologies such as DRY, SOLID and MVC” is not a valid point. Simply because :

those patterns have no formal methods of verification.

You also can’t test that those patterns are respected in your app.

You can write “proper” assembly code to run on the server. The fact that it’s “proper” does not matter because you have to understand your assembly, processors ... in order to maitain the codebase and do evolution on it. I’ll take bad PHP code to maintain over “proper” assembly code anyday, simply for the fact that you can maintain it by knowing less that you would otherwise (whithout taking into account, more technical issues). My point Is that writting something “properly” helps you to maintain and evolve it over time, but it will never solve fundamentals issues of your language (or stack), for all its qualities PHP requires to know its quirks and there are legion.

PHP is fast fo pick up, has a model that fits fine with the HTTP protocols ( stateless request / response), can be run everywhere, have great frameworks and a great community. I think that to begin with PHP is not a bad choice, especially if you aim at being operational fast.

However PHP7 does not fix PHP, it helps but it does nor fix it. Yes it is broken : eev.ee/blog/2012/04/09/php-a-fract...
In the space of distributed application, PHP lacks maturity compared to Java (jvm rocks) by example, in the space of concurrency and parallism, there are also better choice.

In short, yes PHP is not dead.
Statistics don’t say that it’s a good, just that it’s there.
Yes every languages have flaws but very few have flaws like PHP (where is PHP 6??) which are important to know.

It does matter for those who plan to work in challenging environments in the futur.

Hello, I translated your article into turkish here, medium.com/@midorikocak/2018-y%C4%... I hope it's not a problem. I could not ask in advance because I hurried and thought it should be heard from turkish audience as well. I hope it's not a problem. Thanks.

Hey, no problem at all. Happy for my content to be shared around! Appreciate the translation and the attribution. If you wouldn't mind linking my name to my twitter or dev.to profile I'd appreciate that!

I was doing PHP since about 2009, although I quit it for several years just to return last year.

I needed to work on a project that required some math like genetic algorithms, AI, optimization and pattern matching. I also wanted to play about with hashgraph technology.

One of the points that I thought were crucial to me was this library: php-cpp.com/ . For instance, I was able to compile a dlib-based face recognizer into a plugin, and then use the functionality asynchronously. Also, it turned out that for some issues that didn't need killer performance, a abrandao.com/2015/01/simple-php-ge... trivial implementation that I could then hack on was already there.

Once an article (don't remember the name) stated, that even though other languages give your more elegance, PHP has a very solid community and avialability of third party libraries. It turned out to be true, and I was able to move my code between various projects without much hassle. The namespaces are elegant now.

Another crucial thing I thought of was the availability of frameworks. I don't even have to mention Laravel, however, I developed most in CodeIgniter (back in the day). When I got tired with Laravel's artism, I finally found Slim3. Then, once I dropped Twig for Vue.js as frontend, I arrived at something that is satisfying to work with.

The PSR4-7 as well as both composer and npm give a solid background. The availability of testing suites is enough for my needs.

Overall, a year ago PHP looked like the most battle ready setup I could find. I also did a Rails bootcamp once, but since I already had some experience with ye olde PHP, jumping the ship seemed too much - perhaps it was a mistake.

Thanks for this - we are heavy PHP users, under Laravel/React and agreed it can be very bad, but good standards, management, and tools allow for very high-quality work with a diverse engineer base to draw from.

Another reason we chose PHP was that all our other tools like Zabbix, SugarCRM, and others were sizable PHP apps, plus a broad base of good & strong frameworks like Laravel, etc.

As a large-scale MSP, we also still have lots of customer doing big systems on PHP. Fair amount of Java, bit of Node.js & Python, but still lots of very large sites in PHP.

I have no problem with PHP in general; I don't like the tooling as much as I like what is available for .NET. It as always come down to the reputation that PHP has gained as being "insecure". This is mostly reputation (although not entirely un-earned) and not core fact though.

The biggest thing is PHP is very easy to write poorly. Given that WP is based on it and the issues with WP security mostly boils down to poorly written plugins; it isn't impossible to see how we got here and why we are still here. Any code in any language when written poorly, is bad; and that is hardly the languages "fault".

The latest iterations of PHP have impressed me; but it still won't be my go-to solution based on my experience with other languages being greater and wider-reaching.

I do think getting statistics on usage is going to be difficult at best and wildly inaccurate at worst. There are so many "web based" solutions that you'll never see on the internet. PHP most likely makes up far less of the world than these surveys imply.

Not to troll but, I've seen companies still using Visual Basic 6- for their operations, I'm sure PHP will be alike in future years for the same reasons, It just works, and i still have people that can do things with that.

However I want to say that PHP is a useful language with all its quirks and weirness, Wouldn't use it but Don't complain on people using it :D