Web >> Development >> PHP >>  How to highlight matching words

$string = "one two three four"; $result = preg_replace("/(one)|(two)/","<b>replacebegin:content:replaceend</b>",$string); print $result;