Let's say this is my HTML:
<ul>
<li><div style="width: 10em;">Hello</div><div class="ble"></div></li>
</ul>
I want to get this:
<ul>
<li>Hello</li>
</ul>
As you can see, all div opening and closing tags were removed but not their content!
This is what I have so far:
$patterns = array();
$patterns[0] = '/<div.*>/';
$patterns[1] = '/</div>/';
$replacements = array();
$replacements[2] = '';
$replacements[1] = '';
echo preg_replace($patterns, $replacements, $html);