I want a php function to identify every sub-string in a string between 2 tags, then apply a process such as htmlentities() to the substring and then replace each substring with the new one. Needs to be commented so I can add other php operations to the substring such as htmlspecialchars() for example:-
hello, how are you to make things bold you do this <code><b>this is bold</b></code> and this is in <code><i>italics</i></code> would become:-
hello, how are you to make things bold you do this <code><b>this is bold</b> and this is in <code><i>italics</i></code>
The tags must be passed as parameters - example <code> and </code> because I may use others or even text - eg: **start** and **finish**
I expect part of the function to look like:-
$substr = htmlspecialchars($substr)
$substr = htmlentities($substr)
so i can easily add in more instructions. The strings being processed may be very long, up to 1mb or more. The strings may contain also ' and ""
This is a very quick simple project so I will be looking at the bidder, it really is a few minutes work!