What is the function mime_content_type() used for in PHP?

The function mime_content_type() is used in PHP to determine the MIME type of a file. This can be useful when working with file uploads or when needing to verify the type of a file before processing it further in your code.

$file = 'example.txt';
$mime_type = mime_content_type($file);

echo "The MIME type of $file is: $mime_type";