cant understand it what makes it different from php? and can I use it with php?
I didn't use nodejs but I'm positive it's much better than php
They both follow MVC if we are talking about laravel
Node is very different from PHP It has lively community creating awesome libs, easily downloadable and manageable using npm The language itself is constructed very differently in PHP, when you write an app, you write some code in a file, which becomes your route, and set up an external server which calls your php. In JS, you create a server in your code. You have full control over it from the JS level. PHP is synchronous — when you contact a database, or read a file, PHP waits until it's done. If you want to do many things at the same time (and you want), you have to use threads or processes. Whereas in Node, when you do anything which is not computation, ie. filesystem access, database access, http request, Node schedules it to run in the background, and proceeds to do other things in the meantime, which means one process can do a lot more, at the expense of being slightly harder to grasp than synchronouse langs (read about Promises and async / await tho, it helps a lot). And you can spawn multiple processes as well.
Node is a standalone program. It runs everywhere. PHP is _mainly_ a webserver module Node's primary goal is to execute javascript programs PHP main goal is to parse documents and execute parts of them them right before the web request cycle is done Node is a very broad environment, well suited for a lot of general tasks PHP is very tighly copuled with web execution
async everything makes it great How can you read two files at once in PHP?
Обсуждают сегодня