<?php
$dom = new DOMDocument;
@$dom->loadHTML('<body style=""><p class="Normal" style="direction:ltr;unicode-bidi:normal;"><span class="Normal-H"><span class="-H" style="font-weight:bold;"></span><span class="-H" style="font-weight:bold;">Some bold text</span></span></p><p class="Normal" style="direction:ltr;unicode-bidi:normal;"><span class="Normal-H"><span class="-H" style="font-style:italic;"></span><span class="-H" style="font-style:italic;">Some italic text</span></span></p></body></html>');
$xPath = new DOMXPath($dom);
$spans = $xPath->query('//span');
foreach($spans as $span){
if($span->hasAttribute('style')){
if(strstr($span->getAttribute('style'), 'font-weight:bold') !== FALSE){
$newSpan = $dom->createElement('strong', $span->nodeValue);
$span->parentNode->replaceChild($newSpan, $span);
}
}
}
echo $dom->saveHTML();