What is the best way to delete HTML files of a certain age using PHP?

To delete HTML files of a certain age using PHP, you can use the `filemtime()` function to get the last modification time of the file and compare it with the current time minus the age limit. If the file is older than the specified age, you can use the `unlink()` function to delete it.

$directory = 'path/to/html/files/';
$ageLimit = 86400 * 7; // 7 days in seconds

$files = glob($directory . '*.html');
$current_time = time();

foreach ($files as $file) {
    if (is_file($file) && $current_time - filemtime($file) >= $ageLimit) {
        unlink($file);
    }
}