I need to replace < and > with < and > in an HTML string. The problem is that I don't want to replace ALL occurrences of < and >, just the ones inside bbcode-like tags:
[javascript] ... these < > should get replaced with entities ... [/javascript]
these shouldn't because they are outside bbcode tags.
So far I've got:
$text = str_replace(array('<', '>'), array('<', '>'), $text);
but this replaces everything...
Any ideas?