What is the purpose of the Content-Disposition header in the PHP code for file download?

The Content-Disposition header in PHP code for file download is used to specify the presentation and file name of the downloaded file. This header allows the server to suggest a filename to the client when the file is downloaded, making it easier for the user to identify and save the file correctly.

<?php
$file = 'example.pdf';
header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
readfile($file);
exit;
?>