Voting

: max(zero, zero)?
(Example: nine)

The Note You're Voting On

tyler dot reed at brokeguysinc dot com
18 years ago
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>');
}

?>

<< Back to user notes page

To Top