If we look into the way PHP and JS frameworks are written you can see a great difference. JavaScript generally has callbacks/promises for operations that might take an undetermined amount of time. Even though PHP has the possibility to pass functions as a parameter, it's not commonly used.
I'd like to take database operations as an example to state my case:
PHP's Eloquent:
$organization = Organization::where('name', '=', 'test')->first();
Node.JS Sequelize:
Organization.findOne({where: {name: 'test'}})
.then(function (organization) {
// Organization has been fetched here
}
);
As you can see Sequelize uses promises to make the operation async. However, PHP's Eloquent does not.
Apart from framework benchmarks, does this mean the Node.JS is faster/more efficient since it is not blocking? Or is this rather because JS is single-threaded? Maybe I have a wrong perception and is the pattern equally implemented in both languages?