DEV Community

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

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

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