PHP Case Insensitive Word Replacement
- by zuk1
Ok I'm trying to make search terms bold in this search script I'm making, except I can't get it to work case insensitive.
function highlight($term,$target){
$terms = explode(" ", $term);
foreach($terms as $term){
$result = (eregi_replace($term, "<strong>$term</strong>", $target));
}
return $result;
}
That is the function I have so far.. It says on PHP.net that eregi_replace is case insensitive matching but it's obviously not working for some reason. (I'm a noob).
Any ideas? :D