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';
?>
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';
?>
require in php
// Require a file to be imported or quit if it can't be found
<?php
require 'requiredfile.php';
?>
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.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us