I have a function that once in a while gives out an error:
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'd'
Most often it does not. I don't understand the pattern when it does and when it doesn't.
I know almost nothing about regex, so any help would be greatly appreciated.
Here's the function:
function textHighlight($haystack,$needle,$clr='yellow') {
$haystack=preg_replace("/($needle)/i","<span style='background:$clr;'>\${1}</span>",$haystack);
return $haystack;
}
Thank you.