+ 6
require_once(), require(), include()What is difference between them?
how about on this one?
1 Antwort
+ 3
The difference are:
require(): If it can not find the file that is referenced, the application will throw an error and stop the execution.
include(): If it can not find the referenced file it will throw a warning, but the application WILL CONTINUE execution. (sorry for the caps, they are to emphasize)
require_once & include_once work in the same way as include() and require() with the difference that they are slower, since the loading of a file is prevented more than once. This prevents the functions and variables from being rewritten and you have an error associated with it. Normally these versions are used only when they are necessary