Hamender Hamender - 6 months ago 58
PHP Question

remove p tag having br tag in php

I am inserting data in database using ckeditor in php but when I press enter then it generates empty p tag with multiple attributes & br tags having id attributes like that

<p style="text-align:center" id="mf147"><br id="mf148"></p>

how can i remove it ? Please give me solution


I have try this one for removing the tags you required, please check is it working for you preg_replace('#<p\sstyle=".*?"\sid=".*?">(<br\sid=".*?" ?>)</?p>+#','',$string);