PHP File Inclusion
We can directly include the data of a PHP file into another php file inclusion before the server executes it. There are two PHP functions through which we can be used to include one PHP file into another PHP file.
The include() Function
The require() Function
Basically, both function are the same, both are used to insert useful codes written in other files, in the flow of execution.
Include() Function:
In include command, include takes a file name and simply inserts that files contents into the script that issued the include command.
Include will only produce warning like (E_WARNING) and script will continue.
Now, suppose you want to create a common menu i.e. menu.php with the following content:
Now create pages that you wanted and include this php file inclusion tutorial to create header. For example your test.php file can have following data.
This will display the following output
Require() Function
In require function, require will produce a fatal error like(E_compile_ERROR) and it will halt the script. Now we take a above example using require function
It will nothing display and stop the script.














