I need help with php5 regex function. I need function which takes arguments text, Regex, string before, after.
function Highlight($text, $regex, $before, $after)
example is probably the best explanation of what I need.
$text="I have apple and banana."
$regex="(apple|banana)"
$before="<b>"
$after="</b>"
and I need return
"I have <b>apple</b> and <b>banana<b>."
an example is only to illustrate the problem and it will not be an html elements.
thank you
preg_replace_callback()?