Strip just <p> tags in PHP -
i have set of <p></p>
tags wrapping set of data, data includes other tags such <script></script>
content contain number of different tags.
i need remove paragraph tags content
example below
$text = "<p><script>example text inside script.<script></p>";
i see strip_tags function believe remove tags.
how go removing paragraph?
thanks.
try this, works <p>
, <p class='class'>
:
$text = "<p class='class'><script>example text inside script.</script>ss</p>"; echo preg_replace("/<\\/?p(.|\\s)*?>/","",$text);
here working example
wiki
Comments
Post a Comment