DEV Community

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

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

Nočnica Mellifera on August 05, 2021

image by Camilo Sanchez, sharable via 9Creative Commons Attribution 3.0 Unported License](https://creativecommons.org/licenses/by/3.0/legalcode). P...
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
Jack

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
 
spo0q profile image
spO0q 🐒

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
 
jameskpolk profile image
Info Comment hidden by post author - thread only accessible via permalink
James K Polk

And everybody defending PHP pretends that all the criticism of PHP is based on outdated information. My criticism of PHP is based on its incomparably horrendous documentation on php.net. No serious language has such poor official documentation. Most of the pages are missing critical information, and the only hope of finding it is to look through the user notes below the official docs. These notes often go back 20 years, with good and great information intermixed with garbage, because none of it is curated.

Every other language I'm familiar with, C, Pascal, Java, Go, Javascript, Python, Rust ... they all have good to excellent official documentation.

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
 
andraganescu profile image
Andrei Draganescu • Edited

Thank you for adding the missing points. Comparing PHP to COBOL is seriously raising some concerns on the autor's technical background on the topic IMO.

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?

That is never a real question. If you want to do server-side web development you need to know whatever allows you to do just that. PHP is an immensely popular option. This "PHP is dead" bandwagon tried it before with other languages. The languages outlived their fame.

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