Strip HTML tags except the given – PHP

<?php
 $text = '<p>TestP</p><b>Tesb</b> <a href="">TestA</a>';
 echo strip_tags($text);
 //Strip all tags
 echo strip_tags($text, '<p><a>');
 //Strip all tags except p and a
?>
Share

Leave a Reply

Your email address will not be published. Required fields are marked *