PHP | strip_tags() function
strip_tags() function is use to remove HTML, XML, and PHP tags from string. The function provides you the ability to remove tags from strings. You can also ignore certain tags by using the second parameter.
Syntax
string strip_tags ( string $str [, string $allowable_tags ] )
The function takes two parameters in which
$str
Required. Specifies the string which is going to be check.
$allowable_tags
Optional. Specifies the tag which is allowed. These tags will not be removed.
<?php
echo strip_tags("Hello <b><i>world!</i></b>","<b>");
?>
strip_tags function also remove HTML comments. The comments is always removed. This cannot be changed by using the allowable_tags parameter.