What are some best practices for automatically inserting file information into headers in PHP?

When working with files in PHP, it can be helpful to automatically insert file information into headers for better organization and tracking. One way to achieve this is by using the `get_headers()` function in PHP to retrieve information about a file, such as its size, type, and last modified date. This information can then be inserted into the header of the file for easy reference.

$filename = 'example.txt';

// Get file information
$headers = get_headers($filename, true);

// Insert file information into headers
header('Content-Type: ' . $headers['Content-Type']);
header('Content-Length: ' . $headers['Content-Length']);
header('Last-Modified: ' . $headers['Last-Modified']);