strip_tags

string strip_tags(string string, [string allowable_tags]) 

Strips angle-bracket delimited text from a string.

Returns:

String

Description:

strip_tags() removes all angle-bracket delimited substrings from a string. This includes HTML, PHP, SGML, XHTML, and XML tags.

A list of optional tag names to ignore can be specified using the optional allowable_tags parameter. The tag names should be enclosed in angle brackets; for example, "<b><i><em><strong><u>".

Version:

PHP 3.0.8, PHP 4.0b2+

Example:

Strip tags from potentially malicious (or incompetent :) input
 <?php $text = <<<_HTML_ <meta http-equiv="refresh" content="0;URL=http://some.naughty.site.example.com/"> I <b><i>love</i></b> forums that don't filter the HTML tags that they allow ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.