/**
 * Hightlight words in a string
 *
 * @param string $haystack The string to highlight words in
 * @param array $needles The array containing the words to highlight
 * @param string $format The format to use in preg_replace
 *
 * highlight_words will return $haystack unmodified if $needles is empty
 * or if $format is invalid (eg: there is no "\1", which would cause the
 * preg_replace call to fail)
 */
 
function highlight_words($haystack, $needles, $format = '<strong class="highlight">\1</strong>') {
	if (empty($needles) || (strstr($format, '\1') == false)) {
		return $haystack;
	}
	return preg_replace('/('.implode('|', $needles).')/i', $format, $haystack);
}

(Oui, ça aurait pu être aussi Poster sur son blog sans se fouler le cerveau)

EDIT: la voila la phpdoc :p