note 39825 deleted from function.highlight-file by aidan
| From: | aidan@php.net | Date: | Sun, 26 Sep 2004 13:56:25 +0000 |
| Subject: | note 39825 deleted from function.highlight-file by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77374@lists.php.net to get a copy of this message | ||
Note Submitter: orion at dras dot us
----
In case you want to put your highlighted file into an array rather than it output automatically or
into a string, this example shows you how to do this plus put line numbers into the output.
<?
function highlightArray($filename)
{
$content=highlight_file($filename, true);
$content=explode("<br />", $content);
return $content;
}
$filename="index.php";
$content=highlightArray($filename);
$content_count=count($content);
echo "<table>";
for($i=1;$i<=$content_count;++$i)
{
echo"<tr>";
echo "<td><font face=\"verdana\" size=1
color=\"#0000CC\">" . $i . "
</font></td><td><code>" . $content[$i-1] .
"</code></td>";
echo "</tr>";
}
echo "</table>";
?>