Im reading in a piece of HTML text. I want to remove all HTML tags except paragraphs and headings. To do this i use str_replace to replace the tags that i want with string placeholders. Then strip the HTML tags. Then finally replace the string placeholders with the original HTML code. This is where it is failing.
$Text = 'ManyENH3 different';
$updatedText = str_replace("ENH3", "</h3>", $Text);
The above code wont remove the ENH3 string. I have tried messing around and it doesnt work when there is no space before or after the word. I tried using preg_replace and it returns a blank string.