+ 2
For what condition should we use include and for what condition should we use require?
who is better for what condition
2 Respuestas
+ 3
The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop.
Use require when the file is required by the application.
Use include when the file is not required and application should continue when file is not found.
+ 2
Include is used every time you only include a file. Require is used whenever a file necessarily need another file to work. That is, without the required file in question the script not work.