PHP include & require

> include 'page.php';
> include_once 'page.php';
> require('page.php');
> require_once('page.php');

These functions are use for include pages from directory. Here include and require() does same job and the other hand include_once and require_once() also does the slimier action. When you have to include same page many time, then how many times you will code [include 'page.php';] you will get result. Such as if you code [include 'page.php';] [include 'page.php';] [include 'page.php';] three times include or only require('page.php'); function then your code will show the [page.php] three times in your coded div though the page is same. But when you will use [include_once ''] or [require_once('')] for same page you will never get your called page more than one time.

When you are coding then error happening is simple. The major different between include and require() function is, if php get any error into your require('error.php') function then your below written code will be not execute from beginning of your require('error.php); . But if you use [include 'page.php'] function instead of require() function then what will be happen actually?? In that situation you will be notify for only the [include 'error.php'] error but the bellow part of your error stage will be execute.       

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine