In PHP, I have a template with HTML and javascript in it :
<script>
if (a < b) {
alert(a);
}
</script>
<div>
hello
</div>
This is fed into a DOMDocument with the loadXML method, but this procudes an error because of the < character inside the script. I know I could possibly use the loadHTML method instead, but for now I just need a quick fix that replaces the < character inside the script tags, and then replace it later again with a <
So the question is, what is the best method to replace the < character, but ONLY inside the script tags?