DEV Community

loading...
Cover image for Do Developers Still Use PHP (and why that’s the wrong question to ask)
Run [X]

Do Developers Still Use PHP (and why that’s the wrong question to ask)

Nočnica Fee
Actually the pug from Dune (1984)
・3 min read

image by Camilo Sanchez, sharable via 9Creative Commons Attribution 3.0 Unported License](https://creativecommons.org/licenses/by/3.0/legalcode).
People love to ask variations on the question “is PHP dead?” And for added fun, they like to ask it of people who still use it for their jobs, as this article points out. PHP remains extremely popular; something like 79% of websites whose server-side programming language is known use PHP. So to me, the interesting question is not “Do developers still use PHP?”, but “Why do people keep asking if developers still use PHP?”

Part of the PHP hate may come from its origins back in the early days of the web. PHP was developed out of C by Rasmus Lerdorf in 1994, who said it was never intended to be a programming language--he just needed better tools to do stuff with the web that nobody was yet doing in 1994. As a result it’s been derided for its inconsistent syntax, which makes sense if you remember that it was built by one guy trying to figure out how to get his website to communicate with databases. It’s a language of necessity, not careful design, and it’s old. Those facts alone might be enough to turn away some developers.

There are some good reasons to believe that PHP might be on its (very long) way out, in the same way that Rome was “falling” from the moment it stopped expanding. Promising new alternatives like Node for Javascript have been cropping up in the last few years. And in fact, that 79% is actually 79.1% as of this month, whereas back in April, it was 79.2%. So for a developer who already knows Javascript (or Python, or ASP.net), it might be tempting to say that PHP is holding the industry back. It might also make someone ask a developer who uses PHP on the regular whether it isn’t “dead yet”, when the very fact that that developer uses PHP at work means that by definition it is not. People are asking “Is PHP dead yet” because they wish it was.

People who work in tech sometimes assume that the thing that does a job most efficiently in a vacuum will be the thing people automatically switch to using, and that any failure to do so immediately is a bad choice. However, existing infrastructure matters to making decisions about what to do next. If someone invented a new paving material that was easier to make than asphalt, it wouldn’t be feasible to instantly replace all existing roads with NewAsphalt, or to stop maintaining those existing roads. The proliferation of PHP means that it’s likely to persist for a while. After all, there are people who still code in “outdated” programming languages like COBOL in order to work on older digital infrastructure.

Additionally, company culture and experienced senior developers all play a role in which languages get used. Many big players in the web use PHP for back-end stuff, which means they’ll expect their employees to work with PHP, which means that there will be highly skilled people working at desirable companies who use PHP, which means PHP will--well, you get the idea.

So the real question on the table is: with these new alternatives in play, if you want to do server-side web development, do you need to know PHP?

Not necessarily. While a number of companies use PHP, some of those, like Wordpress and Facebook, account for a huge amount of web infrastructure (which is probably driving up that 79% of websites number). If you’re seeking work with a web juggernaut that is known to rely on PHP, it’s certainly worth considering. However, it’s certainly not the prerequisite that it might have been even a few years ago, and very few developers use it exclusively.

However: anecdotal evidence suggests that knowing a less-used programming language can be very valuable to the right employer. Those engineers who can still write in COBOL? They can effectively set their price. PHP might someday be similarly valuable if the infrastructure persists but the knowledge on how to maintain it does not.

I’m curious, though--how often do you encounter the “is x dead yet” question? What kinds of things do you do on the regular that make people ask “oh, are people still doing that?” Let me know in the comments.

Discussion (26)

Collapse
bdelespierre profile image
Benjamin Delespierre • Edited

PHP became popular not because it was easy, not because of it was fast or well designed (it wasn’t). It became popular because it was dirt cheap.

And it was cheap because sharing a server with PHP was stupid easy, because it was possible to sandbox the runtime environment (which wasn’t easy or possible with the available platforms like Java or Perl in the early 2000’s.)

This simple fact had PHP maket shares skyrocket despite its evident flaws. The web was booming and PHP was on top of the wave.

Now PHP is here to stay. It’s now enterprise grade, the tooling and VMs are mature, and it’s updated frequently by an healthy community.

PHP has gone a long way and solved many, many problems along the path, and while it’s still lacking some “cool” features JavaScript has, it’s here to stay - comfy in what it still does best at low cost: HTML server-side rendering.

I’ll wrap this up by asking a simple question: if Boeing or Airbus started coding their planes firmware with JavaScript today, would you board it? 🤔

Because with PHP, sure, I would.

Collapse
stojakovic99 profile image
Nikola Stojaković • Edited

I’ll wrap this up by asking a simple question: if Boeing or Airbus started coding their planes firmware with JavaScript today, would you board it? 🤔

Because with PHP, sure, I would.

I would never dare to step in a plane which uses either PHP or JS for the firmware. Languages for writing firmware are C, C++, Rust and similar ones.

Also, I don't quite understand your comment below. PHP also uses C extensions hugely.

Collapse
bdelespierre profile image
Benjamin Delespierre

Because PHP is standalone and can do stuff on its own. JavaScript is useless without a host program 😊

Thread Thread
stojakovic99 profile image
Nikola Stojaković • Edited

PHP is not standalone, it also needs a program - PHP interpreter 😉

Every language needs something which will convert the language to the machine code eventually. Language is just a specification.

Thread Thread
bdelespierre profile image
Benjamin Delespierre

🤦‍♂️ I’m obviously talking about the platform, not the language itself. PHP platform is standalone. JavaScript platform needs a hosting program. This program can be anything: a database (mongo), a browser (the DOM), a generic C runtime (Node), a game engine (Unreal). Even PHP can run JS

Thread Thread
stojakovic99 profile image
Nikola Stojaković • Edited

And platform is an environment where language is ran. I'm talking about that already.

PHP needs Zend VM, or any other implementation of the language.
JavaScript needs V8 or any other engine capable of running JavaScript. It doesn't need browser, it doesn't need DOM.
There is no difference there.

GraalVM can run multiple languages at once.
graalvm.org/

It's about implementation, not a language.

Collapse
pinotattari profile image
Riccardo Bernardini

I’ll wrap this up by asking a simple question: if Boeing or Airbus started coding their
planes firmware with JavaScript today, would you board it? 🤔

Because with PHP, sure, I would.

No, neither with JS, nor with PHP.

They can be popular, but they have several design flaws that make them "culture broths for bugs."

Seriously, would you board a plane whose software is written in a language that computes "0.15" == "15e-2" by first converting everything to float and then doing the comparison? Sure, operator === exists and a good programmer would use that; but I prefer a language that is able to defend itself from bad programmers and one way to do that is avoiding to be "smart" by converting everything.

Because of this "smart conversion" == (in both JS and PHP) is not even transitive...

Collapse
bdelespierre profile image
Benjamin Delespierre • Edited

You got a point. But I don’t believe any language or platform is more fitted for bug making than any other. I’ve seen my share of bad code in C++ and Java, things you wouldn’t believe, to get rid of the types strictness. Ending up in null pointers everywhere and some guy allocating a 1kb array before the pointer to prevent a core dump, you know… routine stuff in enterprise software 🙄

So I believe software is as bad as the dude (or gal) writing it and every problem resides in the space between the chair and the screen 😂

Collapse
bdelespierre profile image
Benjamin Delespierre

And by the way, it’s still an hypertext pre-processor, comparing it to a scripting language like JS makes no sense at all 🙄

JS can do virtually anything because it does virtually nothing itself. It pilots something else. Node.js is little more than V8 piloting the C library 🤷‍♂️

Collapse
vincenthall profile image
Vincent Hall

PHP 8 is a completely different beast than 5.x and earlier. Further, the tooling for PHP continues to improve. Composer and Laravel are two examples of innovations in PHP that rival any other language’s ecosystem.

Collapse
jmau111 profile image
J.

Most critics about PHP are "deprecated". They think they know the language and its flaws but, most of the time, they refer to very old versions (e.g., php 3, 4, 5).

They often miss the latest evolutions of the language, starting from php 7.1 - 7.4, and, of course, php 8++. You can now use strong types and errors are not silenced, and you can still leverage the benefits of this universal language that can be helpful for an extensive range of applications.

There are great new features that makes sense for professional uses.

Collapse
stojakovic99 profile image
Nikola Stojaković

As an ex-PHP hater I can say that PHP 8 really brought amazing stuff like pattern matching which surprised me. The journey which was started by PHP 7 is progressing great and I hope we'll see even more exciting features coming to PHP.

With that being said, I wouldn't start any new project in PHP if it isn't necessary (my only contact with PHP is through the personal WordPress blog and I rarely change something in the code directly). The reason for that is because PHP doesn't bring me anything I don't have in other technologies. Budget is not a problem anymore - you can spin up a DigitalOcean droplet for $5 and run pretty much anything on it (except for Java or C# projects maybe - I think in that case it would be better to buy one with a bit more RAM).

Collapse
n8chz profile image
Lorraine Lee

What exactly can you spin up on DigitalOcean for $5, and most importantly, how? I'm not trying to be a wiseass, I'm genuinely curious. I'm not a real developer (just an enthusiast programmer). I use PHP for all projects, including new projects, that are "web facing" for the simple reason that LAMP-stack hosting is basically a commodity, has a going rate of $0-10 per month, and certain core things can usually be safely assumed in any given LAMP environment. To the extent that I've window shopped things like Heroku and DigitalOcean I seem to be getting that there's a free tier that's designed to be only useful for hobby or portfolio projects, and that the paid plans start somewhere in the neighborhood of $60 a month (plus I'm way too hosting-illiterate to understand their description of what they're offering in this tier). Obviously I've been misreading the "plans" page of these websites (or perhaps read the wrong document entirely). I'm like Goldilocks, I need something in between the postmodern hosting industry's $0 tier and its $60 tier. If the catch there is that you can use any backend language as long as it's PHP, I find that a minor speed bump.

Collapse
stojakovic99 profile image
Nikola Stojaković

See this: digitalocean.com/pricing

You have an option for $5 which gives you a droplet with 1GB transfer, 25 GB storage, 1 GB RAM and 1 vCPU. It's more than enough for my WordPress blog. You can also choose the operating system (I typically use Debian since it's great for the servers and isn't cluttered like Ubuntu). Now, how it exactly done would take longer to write. I basically SSH into my droplet, set up PHP, Nginx, MySQL, do some administrative tasks to better protect the system and then install WordPress. I've been doing these things for years now but DigitalOcean has great guides which explain how you can set up your application on it.

Collapse
syntaxseed profile image
SyntaxSeed (Sherri W)

I've been around the web dev block for almost 2 decades now. Used PHP for almost that long.

I've seen variations on the "Is PHP Dead?" articles so many times it's not even noteworthy anymore. I've also seen nearly as many that rip PHP apart based on very outdated facts about the language.

It's new to see this article - which is ALSO a slam at PHP disguised as defense.

The proliferation of PHP means that it’s likely to persist for a while. After all, there are people who still code in “outdated” programming languages like COBOL in order to work on older digital infrastructure.

I see what you did there.👀

Oh look another article predicting that PHP is on its way out. Sorry to upset the haters, but PHP is faster & more full-featured than ever. It's jumped into the serverless space & laying the groundwork for multithreading. PHP is the best choice for many serverside projects & it's going to keep improving & building the web no matter how many of these articles get written.

Collapse
christiankozalla profile image
Christian Kozalla

I frequently observe PHP hate and the question. It bothers me a little, but I can live with that. I'd like to learn PHP (like Symfony) once the right opportunity opnmens up.

Also, I hear there is hate against Javascript (not observed personally though) among devs of other languages... So maybe this can't be avoided nor taken seriously.

After all a programming language is a tool that should fit a certain purpose

Collapse
123programming profile image
123 Programming

My biggest problem with PHP is that it is not object-orientated. It is a language with potential, but I personally don't really like it.

This might just be because I'm bad at php, but sometimes I have an error inside a loop which causes the loop to run forever and the error_log file uses about 10gb/s of storage, causing my £2.99 Web server to cry with pain

Collapse
stexaz profile image
Andrius Petrauskis

Oh but it is. Of course you can write non-oop code but most modern applications/frameworks consists of object oriented php. The infinite loop problem is relatable but it can be just like that in any other language, like c or rust. In which case it could break your VPS even faster. It all depends on programmer who writes the code and the tools that are used. E.g. phpStorm (much like other jetBrains products) is superior tool helping to prevent many problems. There are also a lot of static analysis tools, like phpcs, phpmd, phan etc. And of course, phpunit tests. If you test your code well it is very unlikely it will bring any unexpected results.

Collapse
jzombie profile image
jzombie • Edited

I haven't used PHP in years, but I learned the basics of OOP back in 2008 on PHP 5, and that basic knowledge has carried over into OOP with some C++, Python, and JavaScript.

Collapse
dhandspikerwade profile image
Devin Handspiker-Wade

Not sure what you mean. PHP has been object-orientated since PHP 5 (16 years ago)

Collapse
gibi17 profile image
Gibi

PHP's been great and doing well especially since version 7. People who think PHP is dead or dying don't have a clue. I love C# and have used asp.net before, but nothing gets me up and running quickly than PHP + Laravel. It just works, gets the job done w/out the unnecessary complexity.

Collapse
sangeet profile image
Sangeet Khatri • Edited

PHP, Ruby, Python, etc made sense as the mainstream back end languages when the web was a fragmented mess and we needed to reach a common ground of everyone working in a similar structure. That's when Rails happened and most frameworks since then have largely aligned to the structure similar to rails.

And to be able to experiment and reach where these frameworks (Rails, Django, Laravel) did, you needed a language flexible and dynamic enough and they did the job just fine.

But now we have a clear understanding of what we want out of our servers and nowadays they are more or less just an API and aren't being used in the traditional server rendered way that these frameworks were designed for.

Now everything is essentially an API and at this point I really don't see why it makes sense to use a dynamic language like PHP or for that matter Ruby or Python on the server when you can totally use at the very least a strict static language like C# or Go.

Rails and similar frameworks did a lot of good to the web but it's about time we bid farewell to them and move to something designed with services in mind and the way I see it there's no reason to not use a compiled language like Go or at the very least use a static typed language like C#.

The way I see it strong separation between frontend and backend is a good thing and let's keep the backend strictly as the API and keep the frontend as the view layer and with that, I see no reason why you should continue to use PHP when we have more performant and robust strictly typed languages like C# or Go.

Collapse
williamstam profile image
William Stam • Edited

Building a website in python is frustrating. Sure there are nice frameworks (bottle, flask, Django etc) it's still insanely easier doing it in PHP. Suppose in node / Js etc would be easy aswell, but any "assembled" language is just pain for "web".

Collapse
peter279k profile image
peter279k

Sometimes PHP is proper for developing some side or experiment web projects easily.

I also use the PHP to develop some web crawlers then help me to make some duplicated works automated in my life :).

Some comments have been hidden by the post's author - find out more