Let's say I have block of HTML where I want to do a find and replace on the content before echoing out to the screen.
How do I ensure I don't change the HTML but just change the content (in PHP).
For example, if I had this:
<div class='Hello'>Hello</div>
and I wanted to replace all the 'Hello' words in the content with 'Hi' I would want to get this result:
<div class='Hello'>Hi</div>
At the moment I am using preg_replace, e.g.
$new_code = preg_replace(array("/Hello/"), array("Hi"), $code);
But this would give me the result
<div class='Hi'>Hi</div>