Are there any built-in PHP functions or libraries specifically designed for handling MIME types?
Handling MIME types in PHP can be done using the `mime_content_type()` function, which returns the MIME content type of a file. This function can be used to determine the MIME type of a file based on its content. Additionally, the `finfo_open()` and `finfo_file()` functions can also be used to retrieve MIME types of files.
// Get the MIME type of a file using mime_content_type()
$mime_type = mime_content_type('file.txt');
echo $mime_type;
// Alternatively, use finfo_open() and finfo_file() to get MIME type
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, 'file.txt');
echo $mime_type;
finfo_close($finfo);