note 39825 added to function.highlight-file

From: Date: Wed, 11 Feb 2004 22:54:32 +0000
Subject: note 39825 added to function.highlight-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-65030@lists.php.net to get a copy of this message
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>"; ?> ---- Manual Page -- http://www.php.net/manual/en/function.highlight-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39825 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39825&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39825&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65030) next »