note 70059 added to function.highlight-string
| From: | tyler dot reed at brokeguysinc dot com | Date: | Mon, 02 Oct 2006 01:11:29 +0000 |
| Subject: | note 70059 added to function.highlight-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117915@lists.php.net to get a copy of this message | ||
This is a little chunk of code that i use to show the source of a file, i took part of the idea from
a example i found on another php function page.
This code takes a php file and highlights it and places a line number next to it. Great for on the
fly debugging.
<?php
// Get a file into an array
$lines = file('index.php');
// Loop through our array, show HTML source as HTML source; and line numbers too.
echo('<table border=0 cellpadding=0 cellspacing=0>');
foreach ($lines as $line_num => $line) {
echo('<tr>');
echo('<td bgcolor = "#cccccc">');
echo('<code>' . ($line_num + 1) . '</code>');
echo('</td>');
echo('<td>');
highlight_string($line);
echo('</td>');
echo('</tr>');
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 66.66.230.218
----
Manual Page -- http://www.php.net/manual/en/function.highlight-string.php
Edit -- https://master.php.net/note/edit/70059
Del: integrated -- https://master.php.net/note/delete/70059/integrated
Del: useless -- https://master.php.net/note/delete/70059/useless
Del: bad code -- https://master.php.net/note/delete/70059/bad+code
Del: spam -- https://master.php.net/note/delete/70059/spam
Del: non-english -- https://master.php.net/note/delete/70059/non-english
Del: in docs -- https://master.php.net/note/delete/70059/in+docs
Del: other reasons-- https://master.php.net/note/delete/70059
Reject -- https://master.php.net/note/reject/70059
Search -- https://master.php.net/manage/user-notes.php