DEV Community

Cover image for PHP vs Nodejs

Posted on


PHP vs Nodejs

Hi All,
This is my first blog related to PHP and Nodejs. I will go through compare both this technologies and let's understand both languages!

What is PHP?

PHP (Hypertext Preprocessor) was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. It is highly used languages for creating websites. More than 45% of the Website Still use PHP.
Some of successful websites which are now globally still uses PHP like Facebook, Wikipedia, Tumblr, Slack, etc...

What is Nodejs?

In 2009, Node js was born by Ryan Dahl. The idea was the pick-up V8 engine (V8 is an open-source JavaScript engine developed by the Chromium Project for Google Chrome and Chromium web browsers) out side of web browser so can executes javascript codes at server side. Node js is not language but it is open source run-time environment for back-end scripting for in javascipt.
Node js uses by popular companies like Uber, Trello, PayPal, etc..

Which one you should Learn?

For Learning purpose you can dirty your hands on both. PHP is easy to learn and can create a website easily with only some of knowledge of html and css and can deploy with one click.
While in Nodejs You must understand asynchronous behaviour and syntax of javacript. It's not big deal, but must have knowledge of async/await, callbacks, promises, modules, prototypes.

Which one you should pick for next project?

Well, This is interesting. Both languages have their own pros and cons. It does mean that you can not build same application in either PHP or Node js. It depends on requirements of project.
If you need build a blogging, E-commerce website then PHP best suitable.
If you building realtime application like location based or chat application then node js best. Node js also ideal when frontend technologies are also javascript framework like reactjs OR Angular.

Happy Coding!

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.