Spl_autoload not calling second autoload function?

Your code works but probably a misunderstanding Your functions are registered: print_r( spl_autoload_functions() ) returns: Array ( 0 => dataLoader 1 => testLoader ) and if you initialize a class $class_obj = new ClassName() dataLoader will try to load the file: $folder.ClassName. Php Your script will only load the second or any other registered function if he can't find the class in the first place So if you remove your $class in the function dataLoader __autoload won't find the class anymore in the first registered function so he will try to look up for it in the second registered function and so on.

Your code works but probably a misunderstanding. Your functions are registered: print_r( spl_autoload_functions() ); returns: Array ( 0 => dataLoader 1 => testLoader ) and if you initialize a class $class_obj = new ClassName(); dataLoader will try to load the file: $folder.ClassName. Php Your script will only load the second or any other registered function if he can't find the class in the first place.So if you remove your $class in the function dataLoader __autoload won't find the class anymore in the first registered function so he will try to look up for it in the second registered function and so on.

Yes, I assumed that spl_autoload was loading all the closes, but it loads on demand when the class cannot be found. – Devin Dixon Oct 13 at 12:01.

You need to return true; // if the class has loaded and you want that the autoload stack will be stopped return false; // if the class has not loaded and you want to continue the execution of the autoload stack inside your callbacks hope this helps.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions