note 25923 deleted from function.show-source by betz
| From: | betz@php.net | Date: | Mon, 14 Jul 2003 22:27:23 +0000 |
| Subject: | note 25923 deleted from function.show-source by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52107@lists.php.net to get a copy of this message | ||
Note Submitter: pan@simnet.is
----
I made a function from the example from above with a small change.
It counts the first line as 1 instead of 0
<?
function highlight($sFile){
ob_start();
show_source($sFile);
$aContents = ob_get_contents();
ob_end_clean();
$aContents = explode('<br />', $aContents);
$iLen = strlen(count($sContents));
for($i = 0; $i < count($aContents); $i++){
$sGap = ($iLen - strlen($i));
$aContents[$i] = '<span style="color:#999999">'.str_repeat('
', $sGap).($i+1).' </span>'.$aContents[$i].'<br>';
}
$aContents = implode ( '', $aContents );
echo $aContents;
}
?>