Easy Tutorial
❮ Func String Metaphone Func Date Checkdate ❯

PHP strip_tags() Function

PHP String Reference Manual

Example

Strip HTML tags from a string:


Definition and Usage

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

Note: This function will always strip HTML comments. This behavior cannot be changed by the allow parameter.

Note: This function is binary-safe.


Syntax

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

Technical Details

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

More Examples

Example 1

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


❮ Func String Metaphone Func Date Checkdate ❯