Home >Backend Development >PHP Tutorial >Talk about the difference between require and include in PHP
This article will talk to you about the difference between require and include in PHP. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
The difference between require and include in PHP
Same points:
1 , are both used to include files
2. include_once and require_once both check whether the file is included
Differences:
1. When require includes a file, if there is an error in the file , the program will interrupt and display a fatal error.
2. When including a file, if there is an error in the file, the program will issue a warning and continue execution.
3. require is generally used at the beginning of the program
4. include is generally used in the program flow
## In short: require will report an error. If you put at the beginning, you will get a warning. If you put in the middle, you will only need_once. Recommended learning:The above is the detailed content of Talk about the difference between require and include in PHP. For more information, please follow other related articles on the PHP Chinese website!