Write a program in PHP to remove all html tags except paragraph and italics tags
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Solution
The function strip_tags() does completely get rid of all HTML elements. If you just want to keep some elements (for example, some limited formatting functionalities with <b> and <i> and <br /> tags), you provide a list of allowed values in the second parameter for strip_tags().
Syntax
strip_tags(string,allow)
Here, the first parameter string specifies the string to check and the second parameter allowspecifies allowable tags. These tags will not be removed. The given example demonstrates how to remove all HTML tags except paragraph and italics tags -
Output of the above code
need an explanation for this answer? contact us directly to get an explanation for this answerThe term Official Ireland is commonly used in the Republic of Ireland to denote the media, cultural and religious establishment. alert("Nice try!");