DEV Community

Mike Oram
Mike Oram

Posted on

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.

Use of PHP in websites 2017 graph image

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.

Top comments (33)

Collapse
 
mikeralphson profile image
Mike Ralphson

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.

Collapse
 
essiccf37 profile image
essic • Edited

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... AND the web, in order to maintain 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 have to otherwise (whithout taking into account, more technical issues linked to the specific problem that you're solving). 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. Also "properly" is not verifiable.

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. I say Java but you can replace it with every single modern stack for the web (Elixir, .Net...)

In short, yes PHP is not dead.
Statistics don’t say that it’s a good, just that it’s STILL there, like Cobol.
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.

(Edits some mistakes, again)

Collapse
 
guitarkat profile image
Kat

My question is if those patterns are not valid, what is a verified method? Your response did not give an apparent valid method that you are seeking as an example. I'm curious because I use MVC and design patterns as a base of understanding and translating a system. Or what do you mean by validity?

I also think every system is broken. Every framework is broken, but it does move us forward from where we were before sometimes, too.

Systems are inherently, just like humans being perfectly imperfect. :)

I liked reading your response as it was well written and gives me room for thought. Thanks!

Collapse
 
essiccf37 profile image
essic

Thanks for the appreciation :-)

Before replying, I just want to say once more that I find the initiative which allows someone to get a job, to be a good thing, using PHP or whatever.
My original reply was to demystify the idea of the bad press against PHP, is being done by programmers with bad practice.

I agree that every system in general, like everything humans do, have flaws. Perfection is out of this world, to keep trying is part of what makes thing better. Another part is letting things go.

We do not know, how to let go in our industry, so we often debate / rant / troll over things, over and over. I find that most of the time it comes down to the idea of: Cost vs Benefit.

I called PHP broken, because of the cost of these points:

  • PHP has deep design flaws which far overweight its good parts. You cannot get the good part without knowing about the flaws. This create cognitive charge and add a complexity which can be avoided. Part of the reason PHP6, never got out are due to this.
  • PHP as a platform does not have any clear advantages over its concurrents.
  • Complex systems in PHP, are truly hard to maintain, PHP do not scale well. Facebook demonstrated this. They know the web, they have in their staff top engineer who knows all the good practices and still they decided to rewrite the runtime of PHP amongst other thing

PHP is only relevant by its market share, which is reason enough, to being taught (imho) and use but hardly qualify the platform as relevant in itself. PHP7 brings no innovation or game changing feature whatsoever. NodeJS does for example, despite its flaws (still not my thing though), like the way it solves concurrence issue while focusing on performance.

One can argue that, PHP is still fine for small things. I do agree on that.

About MVC or Design Patterns in general, I got no issues with those. However, it’s important to remember that Design Patterns were presented with use case scenario and the cost of using them.
I found useful to read / overview original papers on those subject, you often find little details which changes your perspective. This article about MVC, is a good example, of what you can get when you dig on this: badoo.com/techblog/blog/2017/06/15...

So, in short my point was not about MVC in itself but about the fact that MVC does not guarantee good software. Saying that if I write a piece of software properly using MVC, does not mean that if MVC is used the software has been written properly, neither does it define the term “properly”.

Writing software is hard, that is why good code is rare and that is also why, tooling and the platform being used are as fundamental as using patterns / skills and understanding architecture.

Without knowing which problem is being solved, in which context / constraints, it’s better not to make a statement about any piece of code in my statement.

Thanks !

Thread Thread
 
develcharlie profile image
DevelCharlie

Node.js is not for everyone. It will be when the hosting companies will support it in their plans, until then the PHP shall be the most relevant server side tecnology. If you working in a big company probably node.js is a must, but if you are a onemanband I doubt that your core business is based on node.js

Thread Thread
 
essiccf37 profile image
essic

I do not know of any modern hosting services which does not provides NodeJs out of the box. Even if you find some as long as you can run an installer or some package manager, you’ll get no issue installing Node.

PHP is relevant, I do not dispute this point, it is a major plaftorm use on the web. If the aim is to teach people to be operational in web development it is a good choice but not because « The language has evolved a lot over the years », (again where is PHP 6??) but only because it is a viable long term option to get a job. Also the web runs on many legacy systems or with tools like Wordpress, Mangento ... so yes, most of the web runs on PHP like most legacies in Finance running on COBOL. This only proves that systems are not easily replaced not that PHP is relevant as language, platform or anything other than getting a job in 2018.

My point is that nothing has been demonstrated in the original post.

Node is used by big and small companies. It is also used by onemanband. I do think that it is easier or as easy to pick up than PHP, no web developper can ignore Javascript, which is one of the reason it is easy to pick up.

I am not a Node fan at all but I did and would keep doing work in Node in the future if needed or pertinent to do so. For reasons stated above, I won’t work in PHP ever again.

I mainly work on medium / large project with F#, C# and sometimes Clojure so I won’t deny my biais towards heavier environments which help me scale (yes PHP won’t help you). However as stated before, I think that PHP is not a reliable platform on the long run and that Node is much more relevant for any sized modern backend developpement / websites (server side rendering).

Thread Thread
 
develcharlie profile image
DevelCharlie • Edited

Really node.js requires more and more resources than php, so please go to check the limitations that the providers impose to use it on a shared. If you have a vps, dedi or you are in cloud ok. But many little firms are hosted on a shared plan. And you have to consider the tournover behind little companies that use PHP.

PHP isn't a multipourpose language and you cannot compare it with c#.

PHP has many limitations, has not consistance as we know, but we would like speak about JS?

Of course JS is mandatory in the modern web and JS isn't perfect too. It has not a solid syntax for example (if you use "else if" in JS you'll probably introduce in the code a problem, because JS has not "else if" but it runs without debug error, you can use ; or not, many newbies don't use var and produce bad code).

PHP for many years will be on the run not only for the legacy of the past but because many web developers choose frameworks like Laravel, Simphony. As you know Laravel has choosed vue.js that permits integration with others JS framework, so as you said "no web developer can ignore JS".

if you consider the websites market, PHP will be for many years the king of the server side IMHO

Thread Thread
 
essiccf37 profile image
essic • Edited

I agree with on your point on Node and shared hosting plan, I admit that I am not involved with companies which uses shared plan for a long time now. Even on personal or contract work, I do not even consider shared plan as an option anymore. My mistake, thanks for the correction.

« PHP isn't a multipurpose language and you cannot compare it with c#. » That is interesting to me. There is nothing that you can build in PHP that can’t be done in C#. The reverse is false, since PHP isn’t multipurpose as you stated. However since I can build website in both, why can’t I compare both on building websites ??

JS is not a much better language than PHP, however its ecosystem makes it a modern platform for server side development. If we are talking about a website you can do it on Node but PHP has clearly the upper hand, no question about it.

I feel that I am not clear about my « problems » with the PHP platform, I try to sum it up here :

  • If we talk about server side (web services and middleware), PHP is out of the game as a modern scalable platform today. Even for small services, Node, Flask and many other blow PHP away, period.
  • If we talk about building small to mid size websites, PHP is relevant but I pray that you never have to maintain, over time, the mess that it will get into, as you grow the codebase : PHP do not scale
  • There are no languages where growing a codebase overtime is not a challenge, that’s one of the reason software is hard but PHP does not help you. Same for JS but the tooling is modern and everything transpile to JS. « Writing it properly » or use « {insert any framework / tool / technique here }» can’t change that.

So to me :
« if you consider the websites market, PHP will be for many years the king of the server side IMHO » is more like : PHP ain’t going anywhere any time soon, it is the cheapest solution to bootstrap, it’s hosted where no one else need to go and it’s perfectly fine for people to work with it (Slack for an example) but it’s not a modern solution for any kind of development for a business (small or large) also IMHO.

Also, PHP 6 was never out, there are technical issues with PHP as a platform and a language.

Thread Thread
 
hasnatbabur profile image
Hasnat Babur

Laravel or Symfony are the game changer here.

Thread Thread
 
essiccf37 profile image
essic

My reply is 3 years old.
While some things must have changed, I stay of the exact same opinion :

  • PHP does not scale
  • It does not fit requirements of a modern backend platform
  • PHP only advantage is its reduced cost on mutualised hosting. These are not things that Lavarel or Symfony can fix, imho.
Collapse
 
patrickcole profile image
Patrick Cole

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.

Collapse
 
mrblu3 profile image
Mr Blue

Ye but companys moving away from php, its starting to be hard for php developers to actually find jobs.. if you want to work with php you will need to work with wp, magento or someone similar popular cms. even small company tend to use c# asp.net when they building webb applications.. I think the reason of this is because people now can build there own webbshops, blogs or whatever, without knowing any coding.. When it comes to making a company more automatic people useing c# instead of php. Php isnt dead for it has been so popular on the webb for many years it will take a couple of years until php developers isnt necessary but the digitization of the web starting two destroy the reason of coding in php. the language php insnt dead and will not be dead.

but the ofcource php developers will need to move on to something else for soon there is no meaning of hiring a php developer for the customer can do simple stuff on there own when it comes down to blog, webshops and stuff like that. So for php developers the language is a dead end, unfortunately...

Collapse
 
ravavyr profile image
Ravavyr

Just came across this. I wanted to add that PHP jobs will actually be easier to find within the next 2-5 years, because a lot of PHP devs are older. The newbies of the last 5 years do not know any PHP, so as those older devs move on, get promoted, etc, PHP jobs are going to be opening up and there will be little competition.
Granted no one's come up with a "modern" version of PHP to easily/simply build static sites like Gatsby does for React for example, but really, that's not hard to do, so that should be happening soon i think.

Collapse
 
stevemushero profile image
Steve Mushero

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.

Collapse
 
dguhl profile image
D. Guhl

Third reason: Developers who claim PHP is dead often want to push their own language.

Collapse
 
midorikocak profile image
Midori Koçak • Edited

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.

medium.com/@midorikocak/2018-y%C4%...

Collapse
 
mporam profile image
Mike Oram

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!

Collapse
 
midorikocak profile image
Midori Koçak

Thank you for permitting. I was afraid. I linked both profiles to your name and dev.to in the article. Also thanks for writing the article.

Thread Thread
 
mporam profile image
Mike Oram

Fab, thank you. Your welcome, thanks for reading it!

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

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

Collapse
 
bdwakefield profile image
Benjamin D Wakefield

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.

Collapse
 
piotroxp profile image
Piotr Słupski

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.

I personally don't think so.

Collapse
 
skyrpex profile image
Cristian Pallarés

You got tired of Laravel? How is it? 😆

Collapse
 
piotroxp profile image
Piotr Słupski

It was a long time ago, I stumbled on a token issue I couldn't fix.

I remember that it took me to the core of the app, which at that time, was far beyond my ability to fix

It's not like I'm not planning on a retry, to me it seems I needed to learn more to really get on it ;)

Thread Thread
 
skyrpex profile image
Cristian Pallarés

I understand that. There are a few places in laravel that use dark magic, which I don't like at all.

Collapse
 
gkapad profile image
kapad • Edited

I think, if is to make a discussion about something,
first we MUST define the place that the discussion refers to.
And i explain what i mean. We are in 2018, many and big changes happening in the web development.

(1).
Net is full with virtual servers. Most of the sites we visit,
now run, in virtual servers, big machines with many-many QEmu, ( or another
container technology), running apache/nginx/php, with very limited
resources, disk space or memory.

(2).
Too many develop frameworks. In what? In javascript. Write js code,
or compile, js code. Most of the ( almost all of them, vunerlable, by
content injection).

(3).
Mozilla, a very big browser, change complete its structure,
follow the style Chrome.
Why ? To better support running APPS.

So what is APP ? What has to do with a server ?
An APP have to do NOTHING with a server. APP is Javascript code,
that transfer the functionality of a server,
completly in the clients' browser !!!
Many sites now, follow this methology. Many home computers,
become unstable, when their browsers visit may of theese sites,
because of not enough RAM, big browser cache, and huge swap files.

Let's see 'developers.google.com/speed/pagesp...'.
Performance metrics, is most about Javascript.
If you want to measure something about PHP,
only the server response time, is about.

What i want to say, we must make clear for what we speak.
For Server development, or for Site development, is not the same.

To take a graphic program, and with your mouse to put some buttons,
images, and some text, and complile this as a HTML, this dont make you
a Server developer, and PHP have to do nothing with this.

To develop a Server, deal with security, make responses
base on headers, or queries, and many times this functionality,
must stay hidden for the user, for several reasons, privacy,
security, even if the author dont want to publish its code.
In this process the king is PHP, and i speak again about Servers,
not Sites' pages.

PHP is a scripting language that delivers HEADERS and HTML, nothing else.
Who is real developer, can do ANYTHING just with this.

Can you imagine, facebook, google, youtube, banks,
or other huge public sites, to base their functionality,
on something else than PHP, like client side javascript,
or server side NodeJS ?

We walk on dangerous paths, or not so secure one.
No matter what they say, privacy and security, is not the main concern
of the modern way of Web design.
If you want to do this, you must do this.

Collapse
 
justageek profile image
Brian Smith

I only comment to offer an alternative to the whole "PHP doesn't scale well". I suppose we should tell all the folks at Slack (8 million active users daily) that they don't know what they are doing and they should switch to Java.

Collapse
 
mrblu3 profile image
Mr Blue

Ye but companys moving away from php, its starting to be hard for php developers to actually find jobs.. if you want to work with php you will need to work with wp, magento or someone similar popular cms. even small company tend to use c# asp.net when they building webb applications.. I think the reason of this is because people now can build there own webbshops, blogs or whatever, without knowing any coding.. When it comes to making a company more automatic people useing c# instead of php. Php isnt dead for it has been so popular on the webb for many years it will take a couple of years until php developers isnt necessary but the digitization of the web starting two destroy the reason of coding in php. the language php insnt dead and will not be dead.

but the ofcource php developers will need to move on to something else for soon there is no meaning of hiring a php developer for the customer can do simple stuff on there own when it comes down to blog, webshops and stuff like that. So for php developers the language is a dead end, unfortunately...

Collapse
 
mrblu3 profile image
Mr Blue • Edited

Ye but companys moving away from php, its starting to be hard for php developers to actually find jobs.. if you want to work with php you will need to work with wp, magento or someone similar popular cms. even small company tend to use c# asp.net when they building webb applications.. I think the reason of this is because people now can build there own webbshops, blogs or whatever, without knowing any coding.. When it comes to making a company more automatic people useing c# instead of php. Php isnt dead for it has been so popular on the webb for many years it will take a couple of years until php developers isnt necessary but the digitization of the web starting two destroy the reason of coding in php. the language php insnt dead and will not be dead.

but the ofcource php developers will need to move on to something else for soon there is no meaning of hiring a php developer for the customer can do simple stuff on there own when it comes down to blog, webshops and stuff like that. So for php developers the language is a dead end, unfortunately...

Collapse
 
franksierra profile image
Frank Sierra

About a specific thing that is going on here (and mostly anywhere when talking about PHP)...

By no means PHP it's "not scalable".
As with any language I have being using for the past 15 years or so, you have just two options on scaling either you scale UP or OUT and that’s language agnostic, it depends on the architecture you choose. (We are talking about web development)

The same applies to the usual “PHP code it’s poorly-written” that’s BS
Poorly-written code will exist no matter the language or framework so saying that is objective.

PHP gained traction since 7.1 and that was on December 2016 and v7.0 was released almost at the beginning of 2016
All the links to the articles I've seen on the internet when someone talks about how bad PHP “is” were published prior 2016 or talking about PHP <=5.6

Collapse
 
daniel88ftw profile image
Daniel

Checking back in 2019 - yep, PHP still relevant.