Skip to content

Instantly share code, notes, and snippets.

@alganet
Created April 5, 2011 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alganet/903645 to your computer and use it in GitHub Desktop.
Save alganet/903645 to your computer and use it in GitHub Desktop.
<?php
ob_start();
register_shutdown_function(function(){
$cacheFile = __DIR__.'/cache/'.date('Y-m-d');
$cacheTime = 18000;
if (file_exists($cacheFile) && time() - $cacheTime < filemtime($cacheFile)) {
ob_end_flush();
readfile($cacheFile);
}
file_put_contents($cacheFile, ob_get_flush());
});
//Anything here
phpinfo();
<?php
$zero = new DateTime('0000-00-00 00:00:00');
$now = new DateTime('now');
echo $now->diff($zero)->format('%Y years, %m months, %d days, %H hours, %i minutes, %s seconds');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment