I'm trying to use preg_replace to remove tag and it works except for that contains another element like
<span class="img" style="margin-left:20px">
<img src="/upload/photo/news/357/0/270x140o/688.jpg?q=1" width="250" height="125">
</span>
I use this code
echo preg_replace('/<span[^>]*>.*?<\/span>/i', '', $txt);
which contains text gets removed and text too but not containing the image. How to modify the code to remove the with the too?