PHP Include@ Shwetank education.com
PHP Include Function
Creating a PHP Include file will allow you to easily update all your pages from one file.
Features Of Include Function
1.Update different parts of your site from one file.
2. Include content from other web sites outside your server(not possible with SSI).
3.You can include files with .php, .html,txt and other extensions.
Include Function Example
First we create a file which will be included later and it only contains a variable initialisation:
$name = Shwetank;
After this we create an other file which is the main file and it will include the welcome.php as follows:
echo “Value of name before include is: $name
echo “Value of name after include is: $name
Value of name after include is
Value of name after include is:shwetank
Note*-included file are missing then show warning message
// only one time use in one page .
require () //same work in include (), but file are missing then fatal error message
require_once //only one time use in one page .