PHP Function Include

Function Include

We can use include("xyz.php") more than one time in any page. But it creates a problem if xyz.php file contains some functions declaration. Error will come for already declared function in the xyz.php file else not a problem like if you want to use include("xyz.php") two times in page.

Let's say we want to put hundred different web pages. Bunch of time, going to webpage to webpage and updating each one, one by one, with include function.
<li>Home </li>
<li>PHP </li>


  • Home
  • HTML
  • PHP

You need very time to display the above output in your every web page.
Just use include key word and file name that you attach.
include "menu.php";
pThis is first page <p/>

include "menu.php";
pThis is second page <p/>

You need not open menu.php file.
When you open first.php file and second.php file, menu.php file will automatically open each time. Need not require write extra code for menu. Include acts like function call.

Differences between require and include
Both include and require used to include a file but when included file not found Include send Warning where as Require send Fatal Error.

If you like this Article, Share and Enjoy

See Also
Explode Function
str_shuffle Function
strlen Function
strrev Function
Trim Function
strpos Function
isset Function
sizeof Function