php preg_replace在引用后添加引号而不匹配

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");

Why are you using preg_replace for this? It'd be much easier as:

function highlight($needle,$haystack) {
    return str_replace($needle,"<strong>".$needle."</strong>",$haystack);
}