So I have a file lookup.php that's using spl_autoload_register() at the top. It's also namedspaced as "App\Http\Controllers\StaticObjects"
Within the file I have a method that's used to load in classes dynamically based on an array.
foreach ($this->arrayOfRulesMessages as $value) {
//$value = 'Terms1';
$path = 'RulesAndMessages\'.$value;
$obj = new $path();
}
This keeps throwing an error saying "Class XXX not found."
Yet when I just use the non-variable way of instantiating the object, like below, everything works fine.
$obj = RulesAndMessages\Terms1
I don't understand how the variable way of doing this isn't working.