Making HTML XHTML Compliant with PHP

This is function I found on php.net that changes all HTML tags to lower case. You need this to make your HTML XHTML 1.0 Trans compliant.

function reformat ($content){
	$content = preg_replace("#(<\/?)(\w+)(&#91;^>]*>)#e", "''\1'.strtolower('\2').'\3'", $content);

	return $content;
}

Note: This was code that I originally had in a ‘Code’ page, but I’m moving it to a post now. This code is probably really old (years and years old). I enjoy laughing at myself and so should you.

Leave a Reply

Your email address will not be published. Required fields are marked *