Reputation: 455
I have a load of dynamic requires within the code and I was wondering if there was a way to see the php code that was generated as in all the diferent php files put together?
Upvotes: 0
Views: 77
Reputation: 2150
Answer is based on the clarification in the comments of the question:
Autoloading(spl_autoload_*
or __autoload
) is only triggered if a class is not yet defined. Using *_once
has no real advantage here but bears extra cost. PHP makes sure that the class is only loaded once and (if the loader is correctly implemented and no class includes are done by hand) no fatal is thrown.
If you include classes outside of your autoloader by hand you should still use require_once or include_once as you don't know if that class has been autoloaded yet.
I'll also recommend you to stick to a known structure. There are many correctly implemented autoloaders for the PSR-0 and PSR-4(recommended) standards out there. They have the advantage to be compatible with external libraries and IDEs.
Upvotes: 1