note 60664 added to function.highlight-file

From: Date: Fri, 13 Jan 2006 08:40:30 +0000
Subject: note 60664 added to function.highlight-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-101684@lists.php.net to get a copy of this message
here's a simple way to add line numbers and optionally highlight the one that has error on it. just pass file and line arguments as GET variables <?php $f = fopen($_GET['file'], "r"); $count = 1; $line = ""; echo "<table>"; while ($c = fread($f, "1")) { $line .= $c; if ($c == "\n") { echo "<tr style='background: " . (($_GET['line'] == $count) ? "#eedddd" : "#ffffff") . "'><td width='10%'>$count.</td><td>" . highlight_string($line, TRUE) . "</td></tr>\n"; $line = ""; $count++; } } echo "</table>"; fclose($f); ?> ---- Manual Page -- http://www.php.net/manual/en/function.highlight-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60664 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60664&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60664&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101684) next »