Logo Luan Morina
Strip HTML and PHP tags

The PHP strip_tags() function removes HTML and PHP tags from a string. Here are some examples:

Strip all HTML and PHP tags

$content = '<h1>Lorem Ipsum</h1> <p><a href="#">Lorem ipsum dolor sit amet... </a><p>';
$content_without_tags = strip_tags($content);

Strip all HTML and PHP tags, except <p> and <a>

$content = '<h1>Lorem Ipsum</h1> <p><a href="#">Lorem ipsum dolor sit amet... </a><p>';
$content_without_tags = strip_tags($content, '<p><a>');

Strip all HTML and PHP tags from a MySQL table row content

$content = $row["content"];
$content_without_tags = strip_tags($content);
   Strip tags from a string