include()
module.
Later stages, to modify anything in that module, modify only in one location.Then automatically entire project gets updated.
require()
function is also used to include the file in php. include()
: abc.php
[php]
<html>
<body>
<div class="menu">
<?php include 'menu.php';?>
</div>
<h1>Welcome to SPLessons page!!</h1>
</body>
</html>
[/php]
Example: require()
[php]
<html>
<body>
<div class="menu">
<?php require 'menu.php';?>
</div>
echo "Welcome to SPLessons page!!";
</body>
</html>
[/php]
When above code is executed, when any error occurs, the echo statement will not be executed.