Home > Article > Backend Development > Introduction to PHP strip_tags() to remove HTML, XML and PHP tags_PHP tutorial
Syntax: strip_tags(string,allow);
string is required and specifies the string to be checked.
allow is optional and specifies allowed tags. These tags will not be deleted.
Note: This function will always strip HTML comments, which cannot be changed through the allow parameter.
Example:
$str = "Hello world!";
echo strip_tags($str);
echo '
';
echo strip_tags($str, '');
?>
Output result:
Hello world!
Hello world!