DEV Community

Cover image for "Is PHP Dead?" Discussion
Mehmet Aydin Bahadir
Mehmet Aydin Bahadir

Posted on • Updated on

"Is PHP Dead?" Discussion

Tl;dr: it is not.

It was an important moment for me. I was turning 30. One of my best friends organized a lovely house party, and another DJ friend was playing nice music. Even my brother, who was living in Turkey, flew 3000 kilometers and caught the event at the last moment. There were some people that I knew but also some people I barely knew. One of these guys from the second category, who was working in a big IT company, asked me that famous question with a loud voice so I could hear him.

“So you're coding in PHP, is it not dead yet?”

He was sipping his cocktail and made that face with a big grin, which I see on most of the people who asked the same question to me. Yes, writing PHP is a part of my job, but as a software engineer (some call me a developer, but this is another discussion), it’s not the only thing I do. If there could be a chance for me to describe myself, instead of answering the “oh, which language are you working on for server-side programming?” question, I would love to talk about problems I solve, decisions I make, and the architectural reasons behind them.

But yes, I was (and still am) coding in PHP.

And there is a simple reason behind that. It is not just because PHP has the best tools for me, or because I love to write in PHP. But it is because someone else already made this decision ages before me. Yes, in today’s world, people at Booking.com are still writing in PERL, and that does not make them bad developers. The same argument is valid for developers who work for Facebook. Most of the successful companies around the world interview candidates without asking language-specific questions. They mostly focus on the algorithmic intelligence of their potential colleagues without being worried about their language backgrounds. That said, I don’t personally know anyone who only codes in PHP. Still, I am not sure if this is the perfect world that we are living in, but most of the developers I personally know are busy using different languages every day.

Then why is this question still coming up, as Jeffrey mentioned in his tweet here?

I see there are many sins for PHP developers here. However, I do not blame them for this entirely, either. The interesting thing about PHP comes from its nature. Most of the engineers out there did not see PHP as a purely functional language. Indeed, PHP implemented most features of functional programming, but the creators of PHP did not initially build it for this reason. The same thing applies to the argument that PHP is an object-oriented language. Even though the evolution of PHP supplied the required tools to us for good object-oriented design, again, that was not the language’s main goal.

PHP comes with the simplicity of releasing websites. That was the main goal of the language itself, which is mostly forgotten. In today’s world, PHP still runs 78% of the entire internet because of this simplicity.

I’m coming from the simplicity of the language to another simplicity, and that is managing content. Let’s face facts: Wordpress is still the de facto leader of the web. Most content creators use its weird admin interface every single day. Nine out of ten news websites in today’s world draw their strength from this CMS. Honestly, I don’t know how much Wordpress developers earn from their freelance work, but they still do a lot.

And the thing I know, the most important thing, is that content managers don’t know and don’t give a f*ck if the language behind their beautiful admin panel is PHP or not.

I’m coming back to the question and the smile on the face. I can imagine why these smart engineers blame PHP as the source of spaghetti code out there. And let’s get back to the fact that I’m coding in PHP; yes, I do. But believe me, I have no idea what is going on when I look at wp-blog-header.php. A lot has changed in the PHP world over the last ten years, and yes, not surprisingly, you can find elegant code in this world nowadays.

Either way, PHP and Wordpress rule the internet. Let’s respect that and continue to provide solutions to the problems we are dealing with.

Thanks to Jeffrey Way, the reason for this post.

Oldest comments (51)

Collapse
 
rehmatfalcon profile image
Kushal Niroula

Nope, PHP is not dead, and I suspect will be around for a long time. PHP has grown a lot quite recently and its ecosystem and community are very good. Just follow the best practices you would follow in any other language (SRP, Clear variable name, Tests e.t.c.), and you can build robust Softwares with PHP, not just websites. Take for instance Doctrine, its actually one of the better ORM's that I have used.

Collapse
 
adnanbabakan profile image
Adnan Babakan (he/him)

No PHP is not dead yet and won't be for at least 20 years from now on I believe.
PHP is one of the most mature programming languages despite its flaws in architecture which gets fixed eventually in every update. Some people say that PHP is outdated which I don't believe since there are plenty of great frameworks that they get updates pretty often and are very well-structured such as Laravel or Symfony. PHP is yet one of the fastest programming languages both in terms of development and response time amongst most of the programming languages used nowadays.

TL;DR: No it is not dead.

Collapse
 
deogadkarravina profile image
Ravina Deogadkar

No, I had earlier worked on PHP and Wordpress projects. There is still so many individuals prefer PHP built sites. But looking at career opportunities and language preferences many developers neglect PHP.

Collapse
 
jsn1nj4 profile image
Elliot Derhay • Edited

So glad this wasn't yet another post literally asking if PHP is dead. Like you, I actually enjoy using PHP.

PHP language development is also moving much faster than it was a few years or so ago.

Collapse
 
jochemstoel profile image
Jochem Stoel

...but the creators of PHP did not initially build it for this reason.

Yes, but?

PHP comes with the simplicity of releasing websites. That was the main goal of the language itself, which is mostly forgotten. In today’s world, PHP still runs 78% of the entire internet because of this simplicity.

PHP was originally created to be a template engine and that is what it fundementally still is. Yes many template engines and frameworks have been built on top of PHP since, each offering some higher level abstraction or Model View Controller like shabang. Its simplicity is not the (only) reason it is still so widely used.

Let’s face facts: Wordpress is still the de facto leader of the web. Most content creators use its weird admin interface every single day. Nine out of ten news websites in today’s world draw their strength from this CMS.

78% of websites uses PHP currently and 9 out of 10 websites uses Wordpress? I am very curious where you get your stats.

...content managers don’t know and don’t give a f*ck if the language behind their beautiful admin panel is PHP or not.

That is a very true statement but you don't want to just please the content manager. You also want to take into consideration how compatible your methods are with other developers in the possible future.

The question whether PHP is supposedly dead or not is ultimately meaningless, depending on what level of analysis you want to answer the question. It's something mostly inexperienced developers like to have an opinion and argue about. I encounter people that get into the exact same discussion about jQuery. Nobody uses jQuery anymore. we have Web Components now!

Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir

Thanks for your comment!

At early times, PHP's simplicity to create websites made itself the most used server-side programming language. Of course, there were some architectural implementations after PHP became popular. Therefore PHP itself still keeps its leading position even backends are not simple templating engines anymore.

We are on the same page with you about continuous support of development. Of course, the only concern should not be all about making users or editors happy and shipping things fast. You also should not be the person who writes that spaghetti codes around, as I described in the article. But this is all about the development skills of you. It's not much to do with PHP itself.

Collapse
 
jochemstoel profile image
Jochem Stoel

I think you misunderstand what I said though, which is that PHP was designed to be a template engine from day 1.

Collapse
 
baptistecrouzet profile image
Baptiste Crouzet • Edited

In PHP we have real "best practices" like PSR. In the newest JavaScript frameworks we don't even know if the ";" is mandatory or not. The documentation often differs with the examples. And I don't found the learning curve as good as everyone said it to me.
With PHP you can do almost anything, the performances are really good (I'm waiting for PHP 8) and it won't be acclaimed just because it's "new".

Collapse
 
ben profile image
Ben Halpern

I made this thread...

And someone wrote this...

I agree about keeping dependencies low in small projects! When I hop between multiple projects, I can feel the context switching cost if there are setups involved.

By the way, this looks like a great use-case for…

<html lang="en">
  <head>
    <?php include 'workspace/meta.partial.html'; ?>
    <style>
      <?php include 'workspace/style.partial.css'; ?>
    </style>
  </head>
  <body>
    <?php include 'workspace/body.partial.html'; ?>
    <script>
      // Data
      var data = <?php include 'workspace/data.json'; ?>;

      // Code
      <?php include 'workspace/scaffold.partial.js'; ?>;
      <?php include 'workspace/dynamic.partial.js'; ?>;
    </script>
    <?php include 'workspace/analytics.partial.html'; ?>
    <?php if (isset($_GET['test'])) include 'workspace/test.dev.html'; ?>
  </body>
</html>
# Launch a development web server
$ php -S 0.0.0.0:1234

# View production build
$ open http://localhost:1234

# View test build
$ open http://localhost:1234/?test

# Build static site
$ php index.php > index.html

And it kind of blew my mind because I'd kind of forgotten all about php in a way. It doesn't scross my mind how damn useful it can be if used for the right purpose.

Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir • Edited

I am more than happy to hear this from you! Maybe a bit out of context, but this reminded me a conversation between Adam Wathan and Pieter Levels here

Collapse
 
ziizium profile image
Habdul Hazeez

It was joy when I read your post about building an SSG then I was like: What would people say about @ben building an SSG when there are "solutions" out there?.

I scrolled down to read the comments and the first comment I read was the one included in your comment, and I was like this is simple and interesting as it gets.

I did not bother to read the remaining comments. With Backspace or Ctrl + W, I was off.

Collapse
 
mubbashir10 profile image
Mubbashir Mustafa

I have spent couple of years developing apps in PHP and it's not dead per se. Things have been improved lately, especially with the release of Laravel & PHP 7. Also, WordPress, written in PHP, dominates the CMS market and its popularity is only increasing.

Thanks for the article, it's really useful for people who develop in or want to learn PHP 🙏🏽

Collapse
 
mrgkanev profile image
Gabriel Kanev

No.

Collapse
 
steveblue profile image
Stephen Belovarich

Is COBOL dead?

Collapse
 
ziizium profile image
Habdul Hazeez

Thank me later.

Collapse
 
enapiuz profile image
Vadim

Just triggered by the title. And no, PHP isn't doing to die. It have its niche, big enough. Probably it will outstand some lesser technologies

Collapse
 
ziizium profile image
Habdul Hazeez
Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir

indeed!

Collapse
 
michi profile image
Michael Z

I mean there are exceptions in the node world like adonis.js but most node projects just don't compare with the simplicity and productivity of a good ole Laravel app.

Collapse
 
xowap profile image
Rémy 🤖

Node being shit for back-end dev doesn't make PHP good, though

Collapse
 
iamareebjamal profile image
Areeb Jamal

Preach!

Collapse
 
michi profile image
Michael Z

Just out of interest, have you used Laravel specifically? It has clean abstractions over all the raw hated stuff. Sure it can't get rid of all its flaws but it does a pretty good job at keeping it at a minimum.

Thread Thread
 
xowap profile image
Rémy 🤖

I'm not saying that Laravel is bad per se but given the burden of PHP legacy and all the things that Laravel will never be able to do while you get all of that for free with Django or any other decent web framework, I think that starting a PHP project today is not a rational choice.

Thread Thread
 
tdias25 profile image
Thiago Dias

have you seen what's coming with php 8 or the improvements of php7.X?

Thread Thread
 
xowap profile image
Rémy 🤖

Well, PHP 7.X I looked and used when forced to do PHP, but I didn't had quite a chance look at PHP 8 so far.

My feelings so far would be like:

  • You're telling me that PHP still didn't have str_contains, str_starts_with etc? Also don't get me started on naming conventions.
  • get_debug_type() because apparently gettype() wasn't good enough, although let's keep it for confusion. Also, what the fuck? The type is the type right?
  • Attributes... While it could have been a way to bring meta-programming to PHP or allow patterns like Python decorators do, it's just a way to do the same thing as what already is done in doc blocks, except this time you get a fancy unreadable syntax. Yay.

Overall, when I read the release notes of a nice language I'm like "oh that's neat" and when I do this with PHP I'm like "that's neat... ish... wait wat".

I don't understand why you would lose your time with a language that still by default is just a gigantic print of the file's content, where you can fuck up an entire API with just a single misplaced space or where you still have to code your own module system every single time. Yes it's getting better but what is the point of polishing a turd while you can have diamonds for free?

Collapse
 
mia01 profile image
Mia • Edited

I do get that as well I started off as a PHP dev and now I'm a .net core developer. Still some of the best concepts I learned I learned from my previous team working with PHP. I still haven't met a framework which is as fun to work with, as elegant, and as well documented as Laravel (php). Lots of languages talk about having reflection and how powerful that is when it is already an inherent part of PHP. The dependency injection frameworks part of Symfony and Laravel are also awesome, in addition to things like validation and restful controllers are all made easy to work with.

Collapse
 
codemouse92 profile image
Jason C. McDonald
Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir

This is a nice one!