Powered by Blogger.

Difference Between PHP Include And Require

 


PHP include function: 

The include function is used to include a file within the current process in PHP when you want. It takes one line code which will be a string to the file path you want to include.

include ('header.php');


By using the above code you have to include the header.php page code in the current page where you have specified.

PHP require function: 

The require function work just like the above include function except if the file can not be found it will throw a PHP error. Both are same for inserting external php file to current page but when this code will excute if include function not find the page it will show warning and but will continue with the application. In require function, they will show error and stop the application continuing.

require ('header.php');

No comments