Autoload is changing Scope of variables included in autoloaded file
0
I'm having some trouble with my php project... The autoload function: spl_autoload_register(function ($class_name) { include 'HTMLClasses/'.$class_name . '.php';}); When autloloading classes from the "HTMLClasses" directory, the variables in the autoloaded file which are included from other files are not in its scope anymore. someFile.php require_once $_SERVER["DOCUMENT_ROOT"] . "/config/phpFileIndex.php"; require_once $phpFile['resourcesPaths']; include_once "../autoload.php"; class SomeClass{} the problem now is, that when autoloading this class the $phpFile Variable isn't in the scope of this script anymore. It is Global and i can access it by using $GLOBALS but I do not understand why I need this at all, beacause if I i