Making keywords bold
Posted: Mon Nov 14, 2005 5:00 pm
OK, I came up with this to bold the searched keywords in a database search...
It finds the words regardless of their case, but if the original word is capitalized... it replaces it with lower case words... how do I fix this??
Code: Select all
function highlight($row, $keywords){
foreach($row as $key => $val){
$highlight = "<b>$keywords</b>";
$row[$key] = str_ireplace($keywords, $highlight, $val);
}
return $row;
}