Strip tags in PHP strips all tags, except allowed tags. This function strips tags that you define. Also you can define if you want to strip content as well.
Source code viewer
function strip_defined_tags($str, $tags, $stripContent = false) { $content = ''; } foreach($tags as $tag) { if ($stripContent) { $content = '(.+</'.$tag.'(>|\s[^>]*>)|)'; } return $str; }Programming Language: PHP