I\'m looking for a way to set the scope of require_once() to the global scope, when require_once() is used inside a function. Something like the follow
require_once()
I haven't tried it (since using global vars is a bad idea tbh) but this could potentially work:
require_once '...'; $GLOBALS = array_merge($GLOBALS, get_defined_vars());
Alternatively you can just do it manually:
foreach (get_defined_vars() as $k => $v) { $GLOBALS[$k] = $v; }