only required one php code example
Example 1: php require vs require_once
//The require statement has two variations, require and require_once.
//The require/require_once statement is used to include file.
// Require a file to be imported or quit if it can't be found
<?php
require 'requiredfile.php';
?>
// Require_once is ignored if the required file has already been added by any of the include statements.
<?php
require_once 'require_oncefile.php';
?>
Example 2: echo require php
return.php
<?php
$var = 'PHP';
return $var;
?>
noreturn.php
<?php
$var = 'PHP';
?>
testreturns.php
<?php
$foo = include 'return.php';
echo $foo;
$bar = include 'noreturn.php';
echo $bar;
?>
//$bar is the value 1 because the include was successful. Notice the difference between the above examples. The first uses return within the included file while the other does not. If the file can't be included, false is returned and E_WARNING is issued.