note 21074 deleted from function.show-source by spic
| From: | spic@php.net | Date: | Thu, 19 Sep 2002 21:56:50 +0000 |
| Subject: | note 21074 deleted from function.show-source by spic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-36997@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;