What potential issues can arise when trying to extract file extensions from PHP files with headers like 'Content-type: application/pdf'?

When trying to extract file extensions from PHP files with headers like 'Content-type: application/pdf', potential issues can arise if the file extension does not match the actual file type. To accurately determine the file extension, you can use the PHP function `pathinfo()` to extract the extension from the file name instead of relying on the content-type header.

// Get the file name from the URL or file path
$file = 'example.pdf';

// Extract the file extension using pathinfo()
$extension = pathinfo($file, PATHINFO_EXTENSION);

// Output the file extension
echo $extension;