DEV Community

Logan Johnson
Logan Johnson

Posted on

PHP and Node... Which should I learn?

I've had people come to me in some private messages and ask me:

"Should I use Node since PHP is outdated?"

I usually respond with:

"Well, PHP isn't outdated. It just comes down to preference in the end of the day."

I know it's preference.. but which is better?

Let's take a look at the statistics:

PHP:

W3Tech's research tells that roughly 78.9% of the web uses PHP

Another survey from NetCraft also says that 30% of this, is WordPress hosted.

PHP powers a majority of the web as we know it today. If anyone has updated statistics, please make sure to state that in the comments of the post, but this is the numbers I found.

Node:

W3Tech's research also tells that roughly 0.8% of the web uses Node

Do not let the statistics decide which to learn though!

Many might now say: "Learn PHP then, because the market is much larger?"

There are people in all areas to work with inside of!

Node is also known for performing better because of speed. It can handle more requests per second, and in general it is faster.

So what do I pick?

You're probably learning Javascript, so if you want to stick with the fastest route, you can learn NodeJS since syntax should be similar (for which I haven't really dove deep into).

Personally, I am using PHP right now, however I believe that everyone should learn both. Others have their opinion, and i'm sure the comments will be world war III in developer arguements between NodeJs professionals (for which I am not) and PHP professionals (I know PHP, but i'm not a professional here either).

All I ask for when you debate is that we keep discussions here informational and respectful and not trash on old development threads and repositories. Keep in mind that technology changes rapidly (which i'm sure you already know) and that people have changed much in opinion over these years.

Let me know what you all are using for your work!

Discussion (1)

Collapse
filips profile image
Filip Š

Learn and use both, depending on what you are developing.

Node.js is often (but not always) better for real-time applications (WebSockets) but for other things, PHP is better. Both languages have good web frameworks and are extensible with third-party libraries and frameworks.

Some people say that because PHP is old, it is bad and weird. Some of this may be true. However, in the last few years, especially since PHP 7, it has improved a lot and many things got fixed. At the end of this year, PHP 8 is expected to be released and it will include JIT and other performance and functionality improvements.

Some people also say that JavaScript is weird so you shouldn't use it. This may also be true, however, JavaScript also improved in last years since ES6. However, for some things, you may still need transpilers to support some Node.js versions, but they often aren't hard to set up.