What is difference between require() and include()?

by:

PhpPHP Interview Questions

  • require() and include() both are used for including files in PHP.
  • When you include a file using include() and that file is not exists then it will give warning(E_WARNING) and the rest script will continue.
  • When you include a file using require() and that file is not exists then it will give fatal error(E_COMPILE_ERROR) and the rest script will not run that means  stop the execution of script.

Syntax: