DEV Community

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

Posted on • Edited 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.

Top comments (51)

Collapse
 
crtl profile image
crtl

I started web development around 2012 and back then node, django, rubyonrails and more were rising but I could never wrap my head around why you would ever use them over PHP.
Starting with the environment theres nothing more supported than PHP, you can go to any provider and it will have Apache/PHP stacks available. Also the cost is very low. You can get a domain with server for 5-30€ a year. With python etc. you first have to set up your VM with a cloud provider, connect your domain with it and install some other software to make it run.
Also I really love the whole community and environment.
People always argue with StackOverflow questions but thats the most bullshit Ive ever seen because it only show that more people have problems with a language.
If you are active in PHP tags most of it is duplicates, laravel stuff of people who dont really know what theyre doing or very specific problems because everything has already been answered.
There are a ton of library and everything you need to get a full scalable web app up and running fast with low cost.
Also the documentation.
To this day I havnt seen a better language reference.

Collapse
 
kushal-niroula 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
 
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
 
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
 
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
 
geraldokandonga profile image
Geraldo Kandonga • Edited

Insecurity and imposter syndrome that many software developers go through, is what make them talk bad about a language, in my own experience I don’t think a language is the problem, it can never be! It’s like trying to put someone down so that you can feel better. I love all the programming languages out there.

Collapse
 
themattyg profile image
Matt Graham

This. Like an infinite loop, saying that a language is crap on some forum then another developer reading that just makes imposter syndrome that much worse.

Every language has its flaws. Use the one you’re assigned or pick one with which you can live with the flaws.

Collapse
 
geraldokandonga profile image
Geraldo Kandonga

I don’t think it’s really healthy to talk crap about something that someone has spent time building, deep down it’s just a was of time

Collapse
 
geraldokandonga profile image
Geraldo Kandonga

You are right my friend it should be like that and simple, if you are not happy with a Language just move on to the next until you find the one you are happy and solve your problems.

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
 
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
 
iamareebjamal profile image
Areeb Jamal

Preach!

Collapse
 
nicolus profile image
Nicolus

I think we need to stop having this discussion altogether.

I think there's a collective trauma among PHP developers that dates back to 15 years ago when PHP was a lot more quirky (PHP 4 or early PHP 5 days) and got a lot of heat from some developers. Nowadays there is no reason to even consider if it might be dying.

Sure Go, Rust and Kotlin are great new languages, but it doesn't mean that Python, Ruby or PHP have suddenly become obsolete, and I don't see nearly as many posts asking if Python is dead or if Ruby is dead.

Collapse
 
xowap profile image
Rémy 🤖

Because Python and Ruby aren't pieces of shit, that's why. The only thing that changed in PHP is that the developers became less bad and the tools improved but the language stayed the same.

Collapse
 
iamareebjamal profile image
Areeb Jamal

Dude, I still see most SQL/XSS injection prone websites without password hashing been written in PHP. Just because there are some good sites in PHP doesn't mean most beginners create awfully insecure websites, which you won't find in any other language at all, because beginners in other languages use proper frameworks like Flask, Django, SQLAlchemy. Even go which is kind of frameworkless doesn't suffer from the same level of data leaking websites beginners create in PHP

Thread Thread
 
xowap profile image
Rémy 🤖

I know you can't hold PHP accountable for WordPress but I've definitely spent too many hours worrying about WordPress security and fighting off hackers to not feel a little resent.

Collapse
 
_hs_ profile image
HS

Similar thing goes for Java. They wish it was dead but hey. Also for OOP they would love to kill it off and make everything FP. Althoug I personally dislike the syntax of PHP I don't think it's bad enough to avoid it. I like list.map instead of function_nm_smtg(whyyy) but that's a personal preference

Collapse
 
adnanhz profile image
Adnan

I used to work with Java in 2014 but I've heard it changed a lot since. I left on Java 8 and now on Java 1X, have things changed a lot?

Collapse
 
_hs_ profile image
HS • Edited

Changing is a better term. I used v11 because of var keyword. However 14 has preview of records which are similar to kotlin data classes and switch expressions which means you get to do

var test = switch(something){
    this -> that
    else -> other
}

Something like that. But I'm mainly waiting to see what happens with project loom. However collecting stuff via map or such might still be messy.

Basically some efforts are being made through versions but not as much as devs would want. Example switch expression and pattern matching are still treated as experimetal

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.