What is the PHP function "unlink()" used for and what are its limitations when it comes to deleting multiple files in a directory?

The PHP function "unlink()" is used to delete a file. However, it has limitations when it comes to deleting multiple files in a directory as it can only delete one file at a time. To delete multiple files in a directory, you can use a loop to iterate through the files and delete them one by one using the "unlink()" function.

$directory = '/path/to/directory/';

$files = glob($directory . '*'); // Get all files in the directory

foreach($files as $file){
    if(is_file($file)){
        unlink($file); // Delete the file
    }
}