Answers for "difference between include and require in php"

PHP
8

include and require in php

// Include a file, if it can't be found: continue.
<?php
include 'mainfile.php';
?>
  
// Alternatively: Require a file to be imported or quit if it can't be found
<?php
 require 'requiredfile.php';
?>
Posted by: Guest on April-25-2020
0

Differentiate PHP include and require statement

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.
Posted by: Guest on July-09-2021

Code answers related to "difference between include and require in php"

Browse Popular Code Answers by Language