PHP 8.5.0 Alpha 4 available for testing

Voting

: max(nine, seven)?
(Example: nine)

The Note You're Voting On

adam at roomvoter dot com
21 years ago
The snippet of code earlier that allows you to delete all files older than 2 weeks uses the function (filemtime) - which checks the original create date of the file (filesystem independent). You MAY want to use filectime() - that looks at when the file was last changed on YOUR file system.

if (is_dir("$path") )
{
$handle=opendir($path);
while (false!==($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$Diff = (time() - filectime("$path/$file"))/60/60/24;
if ($Diff > 14) unlink("$path/$file");

}
}
closedir($handle);
}

<< Back to user notes page

To Top