php Include

Include command provides the opportunity to include several php pages within a single page.

php Include

php Include:

     

Include command provides the opportunity to include several php pages within a single page. This feature facilitates us to save our time. Include takes a file name and simply inserts into the mentioned file.

It is very useful in the sense that if you want to put a menu or similar thing in every web-page then you can use Include, and whenever you need to make any changes into the menu, just modify the actual file and the changes will be shown in every single web page.

Let's consider an example of that we have two examples of chat and mail system and we want to put these links in each page:

mail.php is the file for mailing purpose and chat.php is for online chatting purpose.

Now write the following syntax in the file which will serve as the link to the multiple pages (in this case let's consider name of the file is phpLink.php):

<html>

<body>

<a href="chat.php">Chat</a>|<a href="mailPhp.php">Mail</a>

</body>

</html>

Now to get this links in every desired page, all we have to write is:

include("phpLink.php");

To include the links all we have to type the above code in desired files.