]*>/', '', $html); } $maliciousHtml = "

Important

Some bold text.

"; $cleanText = stripHtmlTags($maliciousHtml); // Output: Importantalert('XSS');Some bold text. // This example shows a simple stripping. For actual XSS prevention, // always use a robust HTML sanitization library or built-in functions like htmlspecialchars() and strip_tags(). ?>