$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>'; echo strip_tags($text); // output : Test paragraph. Other text // Note: Allow <p> and <a> echo strip_tags($text, '<p><a>'); // output - <p>Test paragraph.</p> <a href="#fragment">Other text</a> Refer http://php.net/manual/en/function.strip-tags.php