How can the interaction between header/Content-Disposition:Inline and header/filename affect file output in different browsers?

When using the header/Content-Disposition:Inline header in combination with the header/filename header, different browsers may interpret the file output differently. To ensure consistent behavior across browsers, it is recommended to include both headers and set the filename parameter in the header/filename header to the desired file name.

<?php
// Set the desired file name
$filename = "example.pdf";

// Set the headers to force download with the specified file name
header("Content-Disposition: inline; filename=" . $filename);
header("Content-Type: application/pdf");

// Output the file content
readfile("example.pdf");