Home  >  Article  >  Backend Development  >  PHP strip_tags() function to remove HTML, XML and PHP tags from strings

PHP strip_tags() function to remove HTML, XML and PHP tags from strings

高洛峰
高洛峰Original
2017-01-03 09:28:151342browse

strip_tags definition and usage

strip_tags() function strips HTML, XML and PHP tags from strings.

Comments: This function always strips HTML comments. This cannot be changed via the allow parameter.

Note: This function is binary safe.


Syntax
strip_tags(string,allow)

PHP strip_tags() function to remove HTML, XML and PHP tags from strings

Technical details

PHP strip_tags() function to remove HTML, XML and PHP tags from strings

strip_tags Example 1,

Strip the HTML tags in the string:

world!");
?>

Result

Hello world!,

Example 2

Strip the HTML tags in the string, but allow the tag:

world!","");
?>

Result

Hello world!

For more PHP strip_tags() function to remove HTML, XML and PHP tags in strings, please pay attention to the PHP Chinese website for related articles!

Statement:
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 [email protected]