<?php $html = <<<HTML <div> <p>Paragraph 1 <br /> Break line</p> <ul> <br /> <li> New<br>Line</li> <br /> <li> Second line </li> <br /> <li> Third line </li> <br /> </ul> <p>Paragraph two. <br /> break line</p> </div> HTML; libxml_use_internal_errors(true); $dom=new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); foreach($xpath->query('//ul/br') as $br) { $br->parentNode->removeChild($br); } echo $dom->saveHTML();
You have javascript disabled. You will not be able to edit any code.