To organize our code, we can split our file into multiple files and include them when we need.
In PHP, we can use these statements to import files:
The syntax for include and require:
include 'file.php';
require 'file.php';
include_once 'file.php';
require_once 'file.php';
The include_once and require_once will only include the file one time.
The include and require statements are similar, except when there is an error:
include
statement gives a warning (E_WARNING) and the script will continue.require
statement gives a fatal error (E_COMPILE_ERROR) and stop the script.