note 27112 added to function.highlight-file
| From: | pingjuNOSPAM at stud dot ntnu dot NO_SPAM dot no | Date: | Sat, 23 Nov 2002 04:23:05 +0000 |
| Subject: | note 27112 added to function.highlight-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39887@lists.php.net to get a copy of this message | ||
I use this code to view the source with line numbers, it is quite simple, only 5 line if the part
for file information display excluded.
$content = highlight_file($file, TRUE);
$Lines = substr_count($content, "<br />") + 1;
$SizeofFile = number_format(filesize($file), 0, ' ', ' ');
$lastModified = date( "F d Y H:i:s.", filemtime($file));
echo "<div align=center>", $file, " has ", $Lines, " lines, size
is ", $SizeofFile, " bytes, last modified on ", $lastModified,
"</div>";
$content =ereg_replace("<br />",
"</code></li><li><code>", $content);
echo "<ol><li>";
print_r ($content);
echo "</ol>";
--
http://www.php.net/manual/en/function.highlight-file.php
http://master.php.net/manage/user-notes.php?action=edit+27112
http://master.php.net/manage/user-notes.php?action=delete+27112
http://master.php.net/manage/user-notes.php?action=reject+27112