2 ms·
Include inside the body of an anonymous function if you care about toplevel $TIMEOUT=123 overriding some global variable. Anyway you don't have any guarantees
by megous 6y ago
Include inside the body of an anonymous function if you care about toplevel $TIMEOUT=123 overriding some global variable.
Anyway you don't have any guarantees in JS either, for example. Imported module can just redefine Date object prototype or any global via globalThis. If you don't trust the libraries to not make a mess, don't use them is the only real solution. And it will be completely silent as opposed to PHP failing loudly when you try to redefine constant or class or function.
- IgorPartola 6y agoVariables would stay inside the scope of your anonymous function. Functions and classes will become defined globally. Surprise!