Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Serving XHTML With PHP

DZone's Guide to

Serving XHTML With PHP

·
Free Resource
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');
}


Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}