Home > PHP > Function > Strings > strip_tags()

strip_tags()

strip_tags - Strip HTML and PHP tags from a string

Syntax

string strip_tags (string $str, string $allowable_tags)

Arguments

  • str - The input string.
  • allowable_tags - You can use the optional second parameter to specify tags which should not be stripped. Note: HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with allowable_tags.

Description

This function tries to return a string with all NUL bytes, HTML and PHP tags stripped from a given str. It uses the same tag stripping state machine as the fgetss() function.

Version

PHP 4, 5

Return value

Returns the stripped string.