PHP strip_tags() Function

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

string strip_tags ( string $str [, string $allowable_tags ] )

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

Example -

ParameterDescription
strRequired. Specifies the string to check
allowable_tagsYou can use the optional second parameter to specify tags which should not be stripped.

Returns the stripped string.