Hope someone can help with this - I have a function that I'm using to highlight search terms in the results page :
<?php function highlightResult($keyword,$result) {
if (get_magic_quotes_gpc()) {
$replace = stripslashes($keyword);
}
else {
$replace = $keyword;
}
$replaceArr = explode(" ",$replace);
for ( $i = 0; $i < sizeof($replaceArr); $i++ ) {
$result = preg_replace("/{$replaceArr[$i]}/i","<b><font color=#FF0000>{$replaceArr[$i]}</font></b>",$result);
}
$highlighted = $result;
return $highlighted;
}
?>
It works for search words, but not for words combined into phrases using inverted commas....
Does anyone know how to amend it to work for search phrases in quotes too?
Cheers.