require function

require() operates like include(), including a template into the file in which the require() call is located.

require Syntax:

<?php
 require (filename);
?>

However, there are two important differences between require() and include(). First, the file will be included in the script in which the require() construct appears, regardless of where require() is located. For instance, if require() is placed within an if statement that evaluates to false, the file would be included anyway.

The second important difference is that script execution will stop if a require() fails, whereas it may continue in the case of an include(). One possible explanation for the failure of a require() statement is an incorrectly referenced target path.

require example :


<?php
  include_once "require /left.inc.php";
  /* the script continues here */
?>

left.inc.php

left.inc.php is a File.