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.
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.
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 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
Software engineering engineer at a national public broadcaster. Best practices / developer experience / agile / diversity and inclusion / psychological safety
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)
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.
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:
Langue built by people
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
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.
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.
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.
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 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
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.
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
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 )