"; $span_close = ""; $line = explode("\n", $text); $numberOfLines = count($line); $open = false; for($i = 0; $i < $numberOfLines; $i++) { // Need this for later $comment_syntax_length = strlen($close_tags[$i]); // Look for opening comment & closing comment $bpos = strpos($line[$i], $open_tags[$i]); // If it was found if($bpos !== false) { // Take everything to the left of it $left = substr($line[$i], 0, $bpos); echo "$bpos -> $left
"; // Add span tag (opening) $formatted_left = $left . $span_open; // Add formatted left back to the original string $line[$i] = str_replace($left, $formatted_left, $line[$i]); // Search for the next */, starting from the location where /* was found $epos = strpos($line[$i], $close_tags[$i], $bpos+1); // if it was found #if($epos !== false) { $right = substr($line[$i], $epos + $comment_syntax_length); echo "$epos -> $right"; $formatted_right = $span_close . $right; $line[$i] = str_replace($right, $formatted_right, $line[$i]); #} } #echo $line[$i]; } //#for loop } //#cooment } $h = new Hilite(); $h->Comment($text); ?>