Difference Between include and require Statements in PHP - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Monday, December 10, 2018

Difference Between include and require Statements in PHP

PHP include and require Statements:

The include and require statements are identical, except upon failure:
require will produce a fatal error (E_COMPILE_ERROR) and stop the script.
include will only produce a warning (E_WARNING) and the script will continue.
 

Including files saves a lot of work. This means that you can create a standard header, footer, or menu file for all your web pages. Then, when the header needs to be updated, you can only update the header include file.



<html> 

<body>

 <div class="menu">
<?php include 'menu.php';?> 

</div>

 <h1>Welcome to my home page!</h1>
 <p>Some text.</p>
</body> 

</html> 

No comments:

Post a Comment