Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP strip_tags() Function

PHP strip_tags() Function

PHP String Reference Manual PHP String Reference Manual

Example

Strip HTML tags from a string:

world!"); ?>

Run Example »


Definition and Usage

The strip_tags() function removes HTML, XML and PHP tags from a string.

**Note:** 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

)

Parameters Description
string Required. Specifies the string to check.
allow Optional. Specifies the allowed tags. These tags will not be removed.

Technical Details

Return Value: Returns the stripped string.
PHP Version: 4+
Changelog: Since PHP 5.0, this function is binary-safe.
Since PHP 4.3, this function always strips HTML comments.

More examples

Example 1

Strip HTML tags from a string, but allow the use of tags:

world!",""); ?>

Run Example »


PHP String Reference Manual PHP String Reference Manual