I am working with php,
this is my string:
<div style="color:#fff;height:10px">
<table>some code</table>
<div>bla bla bla</div>
</div>
I would like this output:
<table>some code</table>
<div>bla bla bla</div>
The first <div>
tag with its attributes (style, id, etc...) and it closer </div>
is remove from string
You can use regexp:
$new_html = preg_replace("/(^<div[^>]*>|<\/div>$)/i", "", $html);
$alldetail = '<div style="color:#fff;height:10px">
<table>some code</table>
<div>bla bla bla</div>
</div>';
$maindetail = str_replace('<div style="color:#fff;height:10px">','',$alldetail);
$maindetail = str_replace('</div></div>','</div>',$maindetail);
echo $maindetail;