[Solved] Does the ‘require’ keyword in PHP and Node.JS do the same?


They both load code but they are not identical.
PHP’s require is quite a bit closer to just substituting the require line with the (arbitrary) code it loads while node.js works with modules i.e. variables et al cannot that easily “poison” the namespace of the including code. There’s also a distinction between require and require_once in php and on the other side there is node.js’s handling of cyclic require chains which is quite different from php’s require/require_once mechanism.
And so on and on….

solved Does the ‘require’ keyword in PHP and Node.JS do the same?