Here is my code:
function highlight_code ($langName, $codeText)
{
$langName = strtolower($langName);
switch ($langName)
{
case "vb":
$kwarray = array("Private","Sub","End");
//Break up the code into an array of lines......
$codeLines = explode("\n",$codeText);
//Loop through each line of the code
for($i=0;$i<Count($codeLines);$i++)
{
$currLine = $codeLines[$cntLine];
$codeWords = explode(" ",$currLine);
for($l;$l<Count($codeWords);$l++)
{
$codeWords[$l] = str_replace($kwarray,"<font color='#000080'>".$codeWords[$l]." </font>",$codeWords[$i]);
}
$currLine = implode(" ",$codeWords);
}
$codeText = implode("\n",$codeLines);
return $codeText;
}
//return 'This is '.$langName.' code:';
}
What I'm trying to do is take a textbox, break it into lines, loop through each line and then loop through each word to check to see if it's in the kwarray and color it if it is. I then implode the line, implode textbox and return but I keep getting a blank screen. Anyone see where my problem is? Thanks, Jeremy