Is there an alternative, more elegant method to deleting specific data records from the $_FILES array in PHP?

When dealing with the $_FILES array in PHP, there is no built-in method to directly delete specific data records. However, one alternative method to achieve this is by creating a new array and copying over only the desired data records, effectively excluding the ones that need to be deleted.

// Example code to delete specific data records from the $_FILES array
$newFilesArray = array();

foreach ($_FILES as $key => $file) {
    if ($key != 'file_to_delete') {
        $newFilesArray[$key] = $file;
    }
}

$_FILES = $newFilesArray;