PHP Include vs Require
ADVERTISEMENTS
PHP Require Statement
PHP require and include statements that are identical to each other in working and functionality.
Require vs Include Statement
-
Require Statement
- While the inclusion file doesn't exist on the given path require statement will produce a fatal error (E_COMPILE_ERROR) and stop the script.
-
Include Statement
- While the inclusion file doesn't exist on the given path include statement will only produce a warning (E_WARNING) and the script will continue.
PHP Require_once Statement
PHP Require_once statement works the same as PHP Include_once and require_once also follow (E_COMPILE_ERROR) condition during failure.