Home > Backend Development > PHP Tutorial > A php function that can remove html tags from a string

A php function that can remove html tags from a string

WBOY
Release: 2016-08-08 09:34:12
Original
965 people have browsed it

When visitors leave messages and posts, we do not want visitors to use html tags in their messages and posts, so we have to delete the html tags when visitors submit messages and posts. The following function is the function that implements this function
function delete_htm($scr)
{
for($i=0;$i {
if(substr($scr,$i,1)=="<")
{
while(substr($scr,$i,1)!=">")$i++;
$i++;
}
$str=$str.substr($scr,$i,1);
}
return($str);
}
?>

The above introduces a PHP function that can delete HTML tags in strings, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template