DEV Community

Cover image for Underestimated PHP

Underestimated PHP

Alexander Dyriavin on July 02, 2022

After browsing Reddit and Twitter I`ve noticed that the majority of developers underestimate PHP as a language. As with any programming language ...
Collapse
 
pyrsmk profile image
Aurélien Delogu

I hear the axiom "PHP is dying" since ten years. But I think the vast majority that shout it do not even know PHP. In fact, PHP is even more complete and powerful than Javascript, with a less messy ecosystem. But eh! Haters gonna hate.

Collapse
 
chuniversiteit profile image
Chun Fei Lung

It’s a good thing that all those people who keep saying that “PHP is dying” aren’t doctors. Imagine your doctor telling you that you are “dying”, only because you’re no longer the coolest kid in high school… (now that you’re studying at a university)

Collapse
 
dyriavin profile image
Alexander Dyriavin

Good one :D

Collapse
 
dyriavin profile image
Alexander Dyriavin

I personally find it something like this:
People learn JS or Python - because their learning threshold is lower comparing them to PHP. (Based on Stack-overflow survey )

Since both Python and JS - have less elegance in Object-oriented architecture and simpler syntax than PHP, for some people it might be quite a challenge to get used to PHP, which leads to hate.

Collapse
 
insidewhy profile image
insidewhy • Edited

Your ideas about "elegance" and "simple" are not given enough context to be descriptive. I can't even tell if you think you're being objective.

I dislike PHP because it's inconsistent and inherits baggage from objectively poor design decisions that were made in its past. I like many languages that are regarded as more complex than PHP and many that are regarded as less. I believe you'll find that this is the same for many others.

Thread Thread
 
dyriavin profile image
Alexander Dyriavin

Depends on the context and what problem has to be solved.

In every single language we can find inconsistency, mostly because:

  1. Langue built by people
  2. Langue used by people

Taking into account that people different, we cant find a consistent language.

What is important: I dont saying that PHP is perfect, i am saying that people talking "its dying", but its not the case. And the hate around it - as for me - not fair

Collapse
 
pyrsmk profile image
Aurélien Delogu

I completely understand that. I don't even program in PHP anymore myself. Because of the syntax and the procedural API. To me Ruby and Crystal are way better than PHP because of this. In Ruby/Crystal, everything is concise and straightforward and it's a shame it does not have more traction. But eh, everything is about trends!

Thread Thread
 
dyriavin profile image
Alexander Dyriavin

As for me Ruby being underestimated also.

Collapse
 
twirp profile image
twirp

I don't think PHP is dying, but I do think some languages excel in use cases compared to others. I started with PHP4 and used it up until PHP7. My problems and scenarios grew to where other languages supported what I needed to do natively, while PHP felt like a hack or workaround.

PHP and its frameworks are constantly playing catchup. Native Call (FFI) was added in PHP 7.4, Fibers were adding in 8.1, in memory storage was added in PHP 7, threads in PHP cannot be used with a web server, there's no real good solution for web sockets. Most of the time PHP is associated with Shared Hosting, where you don't have the ability to perform complex tasks or bind to ports.

Laravel is a step in the right direction, but there's limitations in Shared Hosting environments where vanilla PHP excels.

Once you step away from Shared Hosting, the argument for PHP is harder to make. For developers who grew up with PHP's initial limitations, a new and improved PHP release isn't enough to convince people to switch back. Constantly playing catchup and knowing limitations are present provide enough reasons to stick to something else for most people.

At the end of the day, it's personal preference.

Collapse
 
dyriavin profile image
Alexander Dyriavin

Fully agreed, looking at the features and progress around PHP - i dont see its dying, i see how the language becomes better with each feature and release

Collapse
 
alaindet profile image
Alain D'Ettorre

PHP is not dying, but it's massively shrinking. It survives today because of these 4 reasons and 4 reasons only for me:

  • WordPress is everywhere, good luck maintaining that code
  • Laravel
  • Cheap costs, deploys and developers
  • Huge amount of third-party libraries and code to maintain

However I'd never choose it for anything relevant these days because it falls short on things like serverless, WASM, compilation, anything outside web development and even testing and standard library are a bit loose. Sure it got better and will pay bills for another decade at least, I've used and appreciated the language, but it's not where the market is going.

JavaScript is much better in terms of integration and ecosystem despite not being as fast, Go is superior in anything except for adoption for now, I don't like Python but still it has very good traction, big third-party registry and does wonders on serverless as well as in any other field except for web development, then there are Java and C# which are both evolving, has massive enterprise support and will surely last longer because of that.

PHP is not dying, but I wouldn't bet on it

Collapse
 
dyriavin profile image
Alexander Dyriavin

Valid point. But as for me there is still no universal language, which can provide you both with 0 complexity of maintenance.

Collapse
 
fjones profile image
FJones

For me it died around the same time, but for a different reason: PHP, around that time, started to move in a direction that doesn't really work for me. It has become a highly opinionated language that, in many ways, tries to emulate other highly opinionated languages.

It's not even just an additive "let's add features to enable more modern best practices" approach, but an active attempt at disabling old language features to prevent supposed missteps. That's not what PHP was about.

Thread Thread
 
pyrsmk profile image
Aurélien Delogu

It was about templating language? 😄

Collapse
 
jacekandrzejewski profile image
Jacek Andrzejewski

Nowadays you don't have to write it twice if you use Laravel with Livewire. Or in case of validation you can use Laravel-Data and generate Typescript definitions of objects. Both have their cons of course.

 
pyrsmk profile image
Aurélien Delogu

Didn't know Bun. This runtime is pretty cool!

Collapse
 
armanist84 profile image
Arman

So, it means the only option is Node. js over there for you?