I have a function that follows this premise:
Explode string into lines by exploding based on /n.
I then exploded the line by " " to get words.
This is where I run into a problem. I have this:
$lineWords = explode(" ", $currLine);
//Loop through each word
for($cntWord=0; $cntWord<Count($lineWords); $cntWord++){
//Process each word
if (array_key_exists($lineWords[$cntWord],$KWarray)){
$lineWords[$cntWord] = '<span style="'.$KWColor[$KWarray[$lineWords[$cntWord]]].'">'.$lineWords[$cntWord].'</span>';
}
}
//Reassemble the line
$currLine = implode(" ",$lineWords);
What happens is if $cntWord is the last, or only, element in the array, it's not getting colorized. Can anyone see why that would happen? Thanks, Jeremy