PHP Tutorial

A web server programming language.

PHP Include & Require

PHP Include and Require

The include (or require) statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement.

include vs require

  • require will produce a fatal error (E_COMPILE_ERROR) and stop the script.
  • include will only produce a warning (E_WARNING) and the script will continue.

Syntax: include 'filename.php';

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics