Home >Backend Development >PHP Tutorial >php filter all HTML tags_PHP tutorial
The article provides you with two PHP methods to filter all HTML tags. It can filter all HTML tags.
The article provides you with two php tutorials to filter all html tags. It can filter all html tags.
//Remove html tags
function text2html($txt){
$txt = str_replace(" "," ",$txt);
$txt = str_replace("<","<",$txt);
$txt = str_replace(">",">",$txt);
$txt = preg_replace("/[ ]{1,}/isu","
",$txt);
return $txt;
}
//Clear html tag
function clearhtml($str){
$str = str_replace('<','<',$str);
$str = str_replace('>','>',$str);
return $str;
}