note 25925 modified in function.show-source by betz

From: Date: Mon, 14 Jul 2003 22:28:24 +0000
Subject: note 25925 modified in function.show-source by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-52108@lists.php.net to get a copy of this message
<? function highlight($sFile){ ob_start(); show_source($sFile); $aContents = ob_get_contents(); ob_end_clean(); $aContents = explode('<br />', $aContents); $iLen = strlen(count($aContents)); for($i = 0; $i < count($aContents); $i++){ $sGap = ($iLen - strlen($i)); $aContents[$i] = '<span style="color:#999999">'.str_repeat(' ', $sGap).($i+1).'&nbsp;</span>'.$aContents[$i].'<br>'; } $aContents = implode ( '', $aContents ); echo $aContents; } ?> --was-- Sorry.. small error in the above one ;) This one works. <? function highlight($sFile){ ob_start(); show_source($sFile); $aContents = ob_get_contents(); ob_end_clean(); $aContents = explode('<br />', $aContents); $iLen = strlen(count($aContents)); for($i = 0; $i < count($aContents); $i++){ $sGap = ($iLen - strlen($i)); $aContents[$i] = '<span style="color:#999999">'.str_repeat(' ', $sGap).($i+1).'&nbsp;</span>'.$aContents[$i].'<br>'; } $aContents = implode ( '', $aContents ); echo $aContents; } ?> http://www.php.net/manual/en/function.show-source.php

« previous php.notes (#52108) next »