Answers for "strip all tags php"

PHP
4

php strip tags

echo strip_tags("Hello <b>world!</b>");
Posted by: Guest on May-18-2020
0

PHP strip_tags — Strip HTML and PHP tags from a string

<?php
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
echo "\n";

// Allow <p> and <a>
echo strip_tags($text, '<p><a>');

// as of PHP 7.4.0 the line above can be written as:
// echo strip_tags($text, ['p', 'a']);
?>
Posted by: Guest on May-14-2022

Browse Popular Code Answers by Language