I want to remove a div tag with all its content..so far i' m able to remove tags that don't contain any other tags inside..e.g <b>bla bla bla </b>..However the div tag i want to remove is like <div class="" style=""><tag>bla bla...<other tag/>....</tag></div>..any ideas??
Use the strip_tags function; http://php.net/manual/en/function.strip-tags.php E.G <?php $tagged = '<div class="" style=""><tag>bla bla...<other tag/>abcd</tag></div>'; $stripped = strip_tags($tagged); print $stripped; ?> PHP: Output: bla bla...abcd