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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -