Server-Side Function

Posted: December 16, 2014 in Functions

Server-side Function

Include Function

Include() function is used to include a specified file into the current file.
It generates a warning error but the script will continue the execution.


<?php

include('middlepage/404.php');

?>

Require Function

Require() function is identical to include() function except it handles errors differently.
It generates the fatal errors means it stops the execution.


<?php

require('middlepage/404.php');

?>

Include_once Function

Similar to the include() function, with the only difference is that if the file has already been included, it will not be included again


<?php

include_once('middlepage/404.php');

?>

Require_once Function

Similar to the require() function, with the only difference is that if the file has already been included, it will not be included again


<?php

require_once('middlepage/404.php');

?>

Header Function

Header fuction is used to redirect a page to another page.
When we run this given code, the page will be redirect to the GOOGLE page.


<?php

header
('location: http://www.google.co.in/');

?>

Leave a comment