Remove html tags from a string wtih PHP
Sometimes you don't need any formatting. That's just a nice way to remove all the html tags.
Remove all tags:
function removeTags($str) {
$str = preg_replace("#<(.*)/(.*)>#iUs", "", $str);
return $str;
}
Remove a specific tag:
function removeTag($str, $tag) {
$str = preg_replace("#\\<".$tag."(.*)/".$tag.">#iUs", "", $str);
return $str;
}