note 28099 added to function.show-source

From: Date: Thu, 02 Jan 2003 06:07:03 +0000
Subject: note 28099 added to function.show-source
Groups: php.notes 
Request: Send a blank email to php-notes+get-41571@lists.php.net to get a copy of this message
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>"); } -- http://www.php.net/manual/en/function.show-source.php http://master.php.net/manage/user-notes.php?action=edit+28099 http://master.php.net/manage/user-notes.php?action=delete+28099 http://master.php.net/manage/user-notes.php?action=reject+28099

« previous php.notes (#41571) next »