1. The file included by the include(), generates a warning and the script executes continuously when there is any problem with the included PHP file, where as . The file included by the require(), generates a error and stops the script execution when there is any problem with the included PHP file.
2. The syntax are given below:
<?php foreach($values as $pr_data) { include 'products.php';// This will includes this file only once } ?> <?php foreach($values as $pr_data) { require 'products.php';// This will includes this file only once } ?>
Want to read more regarding the File Inclusion In PHP?.
This is main diffrences between the include() and require() functions. Thanks and Enjoy the reading.