note 21074 added to function.show-source
| From: | mark at smartbb dot net | Date: | Sat, 27 Apr 2002 12:49:43 +0000 |
| Subject: | note 21074 added to function.show-source | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29916@lists.php.net to get a copy of this message | ||
Heres a way you can make it display the line numbers:
// Turn on output buffering
ob_start();
// Show source of file
show_source ('sources/FUNC.php');
// Get contents of buffer
$source = ob_get_contents();
// Clean and end buffering
ob_end_clean();
// Split the source into lines
$source = explode('<br />',$source);
// Insert the line number
for ($i = 0; $i < count($source); $i++) {
$source[$i] = "<font color=#999999><code>[$i]</code></font>
$source[$i]<BR>";
}
// Convert back to a string
$source = implode('',$source);
// Print source
print $source;
--
http://www.php.net/manual/en/function.show-source.php
http://master.php.net/manage/user-notes.php?action=edit+21074
http://master.php.net/manage/user-notes.php?action=delete+21074
http://master.php.net/manage/user-notes.php?action=reject+21074