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.

Latest comments (51)

Collapse
 
itsmestevieg profile image
Stevie G

As long as there will be a requirement for a backend there will be a need for PHP! I have been writing in PHP since PHP 3 way back in 1999 and have always got plenty of work! 21 years and going!

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
 
mehdico profile image
Mehdi Mousavi

PHP is an ugly language with a bad-design, but it's not dead. I usually use it for my projects because it is cheap and easy.

Collapse
 
twigman08 profile image
Chad Smith

PHP was my first web language and I built my first web application in it in school.

I don't use it anymore really and honestly haven't used it in a few years. One of our clients has an application that is built on like PHP 5.1.x. It's very old. What makes it worse is that the application is built on top of some really old CMS platform that is no longer a thing and has zero documentation on the internet anymore it seems, or that we can find. We have tried to upgrade the version of PHP it uses but immediately ran into issues where everything would just break. So we still haven't gone down that rabbit hole yet. The code base is also a very delicate thing. You have to be careful changing anything cause it could break so much. Though the application is just so large that paying for a rewrite isn't doable right now.

I myself have no problem with a more modern PHP codebase. Language is simple. It does its job and does it well. It's just not my cup of tea really. I myself just don't like to get old PHP projects from clients because most of the time it just seems they are beyond saving. But that very well could be me since I don't use PHP everyday anymore, and don't know the upgrade process for a really large, poorly documented, PHP project.

Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir

I see a lot of projects around like this one. Tons of security vulnerabilities, so much bad code because of this "fast shipping" mentality. What I think is; it is because of the developer not because of the language.

Collapse
 
twigman08 profile image
Chad Smith

There is no doubt it is the developer and not the language. You can write bad code in any language.

I didn't mean for it to sound like I'm blaming PHP. There is no doubt it is just how it was built and not the language. You can write bad code in any language and any framework.

I do think that maybe older languages see it more since you will have to deal with older code bases a lot more.

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
 
maheshkale profile image
Mahesh K

Golang, Javascript, Rust developers have been killing PHP for since Stackoverflow days. Yet to see PHP dying to be honest.

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
 
fullstackchris profile image
Chris Frewin

Anyone who assumes PHP is dead, or even decaying, is simply wrong. I mean it is literally being actively developed, with PHP 8 coming in December of this year.

I'll admit PHP isn't my go-to, but since version 7, I don't mind using it at all!

Collapse
 
jitheshkt profile image
Jithesh. KT

As long as my bills are covered because of PHP, I can't say it is dead.

Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir

haha good one!

Collapse
 
bobbyiliev profile image
Bobby Iliev

I would say no, thanks to frameworks like Laravel and CMSs like WordPress.

Collapse
 
jpkeisala profile image
Jukka-Pekka Keisala

PHP is not dead but it is in slow decline. That is perfectly normal, new better languages come but until now no programming language has been killed by another language.

Collapse
 
nicolus profile image
Nicolas Bailly

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
 
codemouse92 profile image
Jason C. McDonald
Collapse
 
actuallymab profile image
Mehmet Aydin Bahadir

This is a nice one!

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
 
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!