Archives: November, 2009

Highlight words in a text

This function is used to search and highlight words from the text.

function highlight_words($text,$word){
$text = preg_replace(’/\b’.$word.’\b/i’, ‘$0‘, $text);
return $text;
} (more…)