note 42181 deleted from function.highlight-string by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 07 May 2004 18:21:13 +0000 |
| Subject: | note 42181 deleted from function.highlight-string by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69322@lists.php.net to get a copy of this message | ||
Note Submitter: gustav
----
Didn't get Malcolm's line numbering to work properly, so I made my own function.
<?php
function highlight_php($string)
{
$string = stripslashes($string);
$string = highlight_string($string, true);
$arr = explode("<br />", $string);
$start = "<table width=1000 cellpadding=0 cellspacing=0 border=0>\n";
for ($i=0; $i<count($arr); $i++)
{
$output .= "<tr><td valign=top
bgcolor=\"#f0f0f0\">".($i+1)."</td><td valign=top
style=\"padding-left: 5px;\">$arr[$i]</td></tr>\n";
}
$end = "</table>\n";
return $start . $output . $end;
}
?>