What are the differences in handling Content-Type headers for different browsers when serving files with PHP, especially in the case of Internet Explorer?

When serving files with PHP, especially when dealing with Internet Explorer, it's important to handle the Content-Type headers correctly to ensure the browser renders the content properly. Internet Explorer can be particularly sensitive to Content-Type headers, so it's crucial to set them accurately. One common issue is that IE may not recognize certain file types if the Content-Type header is not set correctly, leading to unexpected behavior or errors.

<?php
$file = 'example.pdf';

header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . basename($file) . '"');
header('Content-Length: ' . filesize($file));

readfile($file);
?>