Where can I put instructions require_onceand why?
- Always at the beginning of the file, before the class,
- In the actual method, when the file is really needed
- It depends on the
Most put frameworks are included at the beginning and don't care if the file is really needed.
Using autoloader is a different case.
Edit:
Of course, we all agree that autoloader is the way to go. But this is a "different case", I was not asking here. (BTW, the Zend Framework Application uses an autoloader, and the files still require strict requirements and are located at the beginning).
I just wanted to know why programmers include the required files at the beginning of the file, even if they probably will not be used at all (for example, exception files).
source
share