remove html tags from a string except p in php
snippet in php

remove html tags from a string except p in php

user9424

$text = '<div class="test"><p>Clean <a href="#">text</a><br><b>Bold</b> text</p></div>';

$cleanText = strip_tags($text, ['p','b','i','br']);