After registering autoload function,
Do we still need to use require_once() to include our class?
I mean,
Autoload function is just called when the class isn’t yet included.
So, using require_once() will gain performance, right ?
What’s the best practice ?
Why would you use require or include if you’re autoloading your classes?
I think it’s like __get and __set method.
Though __get and __set has been configured to return/set property, we also declare the mutator and accessor methods for properties.
So, I think that though __autoload has been configured, we also need to require the files. (to gain the performance).
Is it right ?
If it isn’t, why declaring the mutator/accessor methods though __set() and __get() methods has been configured ?
You need a require_once statement in the __autoload method (or method you have registered with spl_autoload_register) but you shouldn’t need any others that load classes.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.