Include () and require() statement allow you to include the code contained in a PHP file within Including a file produces the same result as copying the script from the file specified and pasted into the location where it is called.another PHP file.
include it wherever you want by include() and require() statement instead of typing the entire block of code multiple times.
A typical example is including the header, footer and menu file in all the pages of a website.
Difference Between Include and Require:
include files using the include() statement then why we need require(). Typically the require() statement operates like include().
The only difference is — the include() statement will only generate a PHP warning but allow script execution to continue if the file to be included can’t be found, whereas the require() statement will generate a fatal error and stops the script execution.