I have a cache folder that stores html files. They are overwritten when needed, but a lot of the time, rarely used pages are cached in there also, that just end up using sp
It should be
if((time()-$filelastmodified) > 24*3600 && is_file($file))
to avoid errors for the . and .. directories.
.
..