$video_name) { if ($video_name == "index.php") { continue; } if(!endsWithCheck(".mp4", $video_name)) { continue; } $create_time = filemtime($video_dir . "/" . $video_name); if ((time() - $create_time) > $delete_after) { unlink($video_dir . "/" . $video_name); } } }