What are some best practices for naming PHP files that contain XML content to avoid browser parsing issues?

When naming PHP files that contain XML content, it's best to avoid using file extensions like .xml or .xhtml to prevent browsers from automatically parsing the XML content. Instead, you can use a different file extension or add a query parameter to the file name to trick the browser into not parsing the XML content.

<?php
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>
<data>
  <item>Example</item>
</data>';