PHP Caching


PHP Caching or create a same working copy of a file or read a php file contents


Place it on the to of the page.
$cachefile = "../cache/".$file_name;
if (file_exists($cachefile)) {
include($cachefile);
exit;
}
ob_start();
?>

Place it bottom of the page.

$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();

?>