note 28099 deleted from function.show-source by aidan

From: Date: Sun, 26 Sep 2004 14:11:03 +0000
Subject: note 28099 deleted from function.show-source by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77398@lists.php.net to get a copy of this message
Note Submitter: spam at tommunism dot net ---- Well, from the note a couple notes ago, I tried it and noticed that it has some issues... thus here is the fixed one: function highlight($file) { ob_start(); show_source($file); $aContents = ob_get_contents(); ob_end_clean(); $aContents = str_replace("<code>", "", $aContents); $aContents = str_replace("</code>", "", $aContents); $aContents = str_replace("\n", "", $aContents); $aContents = explode('<br />', $aContents); $iLen = strlen(count($aContents)); for($i = 0; $i < count($aContents); $i++) { $sGap = ($iLen - strlen($i+1)); $aContents[$i] = '<span style="color: #999999">'.str_repeat(' ', $sGap).($i+1).' </span>'.$aContents[$i]."\n"; } $aContents = implode('', $aContents); echo("<b>$file:</b>\n"); echo("<pre>\n".$aContents."\n</pre>"); }

« previous php.notes (#77398) next »