The `include()` function in PHP includes code from other PHP files and copies them into the file that uses the include statement.
The include()
function in PHP includes code from other PHP files and copies them into the file that uses the include statement.
It is identical to the require()
function, except that whilst the include
function will emit a warning (E_WARNING
) when no file is found, the require
function will throw a fatal error (E_COMPILE_ERROR
), which will cause the script to abort.
Each time a file is included through the include
function, the file will be read and executed. To include a PHP script just once, you can use the include_once()
function.