Current Location: Home> Function Categories> strip_tags

strip_tags

Remove HTML and PHP tags from string
Name:strip_tags
Category:String
Programming Language:php
One-line Description:Strip HTML and PHP tags from strings.

Definition and usage

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

Comment: This function always strips HTML comments. This cannot be changed by the allow parameter.

Note: This function is binary safe.

Example

Example 1

Strip HTML tags from strings:

 <?php
echo strip_tags ( "Hello <b>world!</b>" ) ;
?>

Try it yourself

Example 2

Strip the HTML tags from the string, but allow the <b> tags:

 <?php
echo strip_tags ( "Hello <b><i>world!</i></b>" , "<b>" ) ;
?>

Try it yourself

grammar

 strip_tags ( <
i > string , allow )
parameter describe
string Required. Specifies the string to be checked.
allow Optional. Specifies permitted labels. These tags will not be deleted.
Similar Functions
Popular Articles