The difference between include () and require () is believed to be the most basic problem in PHP. it is also a mandatory question for many companies during interviews. Review: require (): If the file does not exist, a fatalerror is reported. stop executing include (): If the file does not exist, a warning is provided, but the script continues to be executed. Note that when the include () file does not exist, the script continues to be executed, in this case, the difference between include () and require () is believed to be the most basic problem in PHP. it is also a must-have question for many companies during interviews.
Let's review:
Require (): If the file does not exist, a fatal error is reported. The script is stopped.
Include (): If the file does not exist, a warning is provided, but the script continues to run.
Note:
When the include () file does not exist, the script continues to be executed. this occurs only before PHP 4.3.5, which is often ignored.
We recommend that you use require_once () and include_once () to check whether the file contains duplicates.