PHP用双引号替换属性单引号

The geniuses at Hotmail decided to mix single ' and double quotes " for attributes in HTML emails for the lulz. This unnecessarily over-complicates things as I'm trying to get the class and id for the body element in some cases to remove it from CSS selectors. Doing a basic string replacement is obviously not an option here.

I realized that PHP's DOMDocument class does this automatically...

 libxml_use_internal_errors(true); //use this to prevent warning messages from displaying because of the bad HTML
 $html = new DOMDocument();//'1.0','UTF-8'
 $html->xmlStandalone = false;
 $html->loadHTML($b);
 $b = $html->saveXML();