After browsing Reddit and Twitter I`ve noticed that the majority of developers underestimate PHP as a language.
As with any programming language ...
For further actions, you may consider blocking this person and/or reporting abuse
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.
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)
Good one :D
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.
Probably. And also it's a big trend, there's always a black sheep somewhere so people can just beat it without any reason, ahah. But, let's say it, the PHP API should be revised IMO.
Anyway, I really love recent additions in PHP 8.1. Especially named parameters and auto defining properties in constructors.
Strongly agree!
PHP8 game changer as for me.
Brings less boilerplate code, gives you 30% performance boost (thanks to jit )
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.
Depends on the context and what problem has to be solved.
In every single language we can find inconsistency, mostly because:
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
What do you mean by "complete and powerful"?
PHP seems to have a much smaller domain, lower salaries and to be generally more loathed.
Even if it was objectively superior to JavaScript (which I strongly disagree with), learning it or continuing to use it is not pragmatic, few want to be paid less, have fewer career options or be looked down on by others, no matter how unfair that may be.
I mean that the API is more complete, and that its syntax has more modern features (especially in OOP) than Javascript. I don't speak about other PHP native modules, or Node because both have not the same age nor the same purpose. But for example I always find annoying how poor the JS Array API is. And even if I don't like the mainly procedural API of PHP, it has more functions to manipulate arrays than JS.
I guess you're not too familiar with recent ES standards, but when it comes to OOP JavaScript and PHP are very close. JavaScript has private methods/functions now, but not
protected
. TypeScript has had this level of encapsulation for quite some time though.I think in general it's not objectively correct to say that PHP has more "modern features" than JavaScript. One thing that really bothers me is how verbose functional programming can be in PHP and many would argue that functional approaches to coding are becoming more popular than OOP (does that mean "more modern"?)
By API I think you mean standard library, this isn't so much of a problem for me given how easily it is to fill these gaps with third party packages and once you throw tree-shaking into the mix there isn't even a runtime size or performance penalty for doing so.
I'm aware of recent ES additions. Compared to PHP 8.1 there are many things where Javascript is clearly behind PHP. But, indeed, FP in PHP is quite a pain to use.
Yes I meant Standard Library, my bad. Indeed, we can fill the gaps with third party libraries, but it points out what the language lacks of. Anyway, PHP also miss many things and with my comments I just wanted to underline that : no, PHP is quite different from what people think of it. And : yes, Javascript is not especially superior. All depends on what we're talking about.
For example, Javascript is a clear winner when it comes to async task handling.
Edit: just to add that we should not forget that PHP has static type checking
In general, from my experience, i would say that if you are familiar only 1 language, your salary will be lower. Business need problem-solving, and usually you need to solve problems using different technologies.
This is not applicable for JS, since there are a lot of different options to use.
Initially this article suppose to show, that PHP its just the same tool as any other Programming langue, its not meant to say - go learn it.
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!
As for me Ruby being underestimated also.
PHP is not dying, but it's massively shrinking. It survives today because of these 4 reasons and 4 reasons only for me:
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
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.
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
Valid point. But as for me there is still no universal language, which can provide you both with 0 complexity of maintenance.
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.
It was about templating language? 😄
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.
Didn't know Bun. This runtime is pretty cool!
So, it means the only option is Node. js over there for you?