There are already some functions for numbering and highliting a string containging PHP sourcecode on this site, but they were buggy or wasted recouces. I hope this snippet fits your needs.

function my_highlight($text){
$text2 = stripslashes($text);
$split = split("\n", $text2);
$mv = count($split);

/*for design reasons */
if($mv < 100){
$width = "14";
}elseif($mv < 1000){
$width = "22";
}elseif($mv < 10000){
$width = "30";
}else{
$width = "14";
}
/*--------------------*/
echo "<table bgcolor=\"#90ab83\" cellspacing=\"0\" width=\"100%\">";

$text2 = highlight_string($text2, true);
for($i = 0; $i < $mv; $i++){
$t = $i + 1;

echo "<tr><td bgcolor=#7C9B6D width=$width><div align=right><font face=\"verdana\"
size=\"1\">".$t."</font></div></td>";

if($t < 2)
{
echo "<td style=\"padding-left: 5px\" rowspan=\"10000\" valign=\"top\">".$text2."</td>";
}

echo "</tr>";
}
echo"</table>";
}

Yours Sincerely
Marc Giombetti - [url]www.giombetti.com[/url]
----
Manual Page -- [url]http://www.php.net/manual/en/function.highlight-string.php[/url]
Edit Note -- [url]http://master.php.net/manage/user-notes.php?action=edit+33956[/url]
Delete Note -- [url]http://master.php.net/manage/user-notes.php?action=delete+33956&report=yes[/url]
Reject Note -- [url]http://master.php.net/manage/user-notes.php?action=reject+33956&report=yes[/url]