What's wrong with this:
PHP Code:
for($m=0; $m < count($bigWords); $m++){
$strText = preg_replace("/(".$keyword[$m].")/i", "<span class=\"\" id=\"\" style=\"color:".$COLORS[$m]."; font-weight:bold;\">$1</span>", $strText);
echo "<br />";
echo $strText;
}
It's highlighting one letter at a time:
Code:
<span class="" id="" style="color:red; font-weight:bold;"></span>
t<span class="" id="" style="color:red; font-weight:bold;"></span>
h<span class="" id="" style="color:red; font-weight:bold;"></span>
e<span class="" id="" style="color:red; font-weight:bold;"></span>
<span class="" id="" style="color:red; font-weight:bold;"></span>
w<span class="" id="" style="color:red; font-weight:bold;"></span>
h<span class="" id="" style="color:red; font-weight:bold;"></span>
o<span class="" id="" style="color:red; font-weight:bold;"></span>
<span class="" id="" style="color:red; font-weight:bold;"></span>
a<span class="" id="" style="color:red; font-weight:bold;"></span>
n<span class="" id="" style="color:red; font-weight:bold;"></span>
d<span class="" id="" style="color:red; font-weight:bold;"></span>
<span class="" id="" style="color:red; font-weight:bold;"></span>
b<span class="" id="" style="color:red; font-weight:bold;"></span>
u<span class="" id="" style="color:red; font-weight:bold;"></span>