I have a php function that highlights text that has been searched for, it works, until you start searching with quotes, and then it adds slashes, but by doing so, it stops it from matching the rest of the string after the slash.
for example:
what I want it to do:
Search term: Ronnie's h
result: Ronnie's h
actual results:
Ronnie's h
function highlight($needle, $haystack)
{
$result = preg_replace("/(".preg_quote($needle, "/").")/i", "<strong>$1</strong>", $haystack);
return $result;
}
echo highlight("ronnie's h", "ronnie's home");