DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Jeffrey has posted 20 posts at DZone. View Full User Profile

Serving XHTML With PHP

03.09.2009
| 1965 views |
  • submit to reddit
        How to correctly serve XHTML with PHP:

header('Vary: Accept');
if (stristr($_SERVER[HTTP_ACCEPT], 'application/xhtml+xml')) 
{
     header('Content-Type: application/xhtml+xml; charset=utf-8');
}
else
{
     header('Content-Type: text/html; charset=utf-8');
}