note 25923 added to function.show-source
| From: | pan at simnet dot is | Date: | Fri, 11 Oct 2002 06:41:12 +0000 |
| Subject: | note 25923 added to function.show-source | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37928@lists.php.net to get a copy of this message | ||
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;
}
?>
--
http://www.php.net/manual/en/function.show-source.php
http://master.php.net/manage/user-notes.php?action=edit+25923
http://master.php.net/manage/user-notes.php?action=delete+25923
http://master.php.net/manage/user-notes.php?action=reject+25923