PHP strip_tags() Function
Definition
strip_tags()
can strip HTML and PHP tags from a string.
Syntax
PHP strip_tags() Function has the following syntax.
string strip_tags ( string html_text [, string allowed_tags] )
Parameter
Its first Parameter is the string to strip. The second parameter specifies a list of HTML tags you want to keep.
Return
PHP strip_tags() Function returns a string without HTML tags.
Example
Here are two examples of stripping out tags:
<?PHP//from w w w.jav a 2 s . co m
$input = "<blink><strong>Hello from java2s.com!</strong></blink>";
$a = strip_tags($input);
print $a;
$b = strip_tags($input, "<strong><em>");
print $b;
?>
The code above generates the following result.