$inputString = '<p>This is a <script>alert("Sensitive information");</script> paragraph.</p>';
$allowedTags = '<p><a><strong>'; // Specify the tags you want to allow
$cleanedString = strip_tags($inputString, $allowedTags);
strip_tags
by
Tags:
$inputString = '<p>This is a <script>alert("Sensitive information");</script> paragraph.</p>';
$allowedTags = '<p><a><strong>'; // Specify the tags you want to allow
$cleanedString = strip_tags($inputString, $allowedTags);
by
Tags: