PHP 8.5.0 Alpha 1 available for testing

Voting

: max(five, two)?
(Example: nine)

The Note You're Voting On

trixsey at animania dot nu
20 years ago
A neat function I made. Syntax coloring, row numbers, varying background colors per row in the table.

<?
function showCode($code) {
$html = highlight_string($code, true);
$html = str_replace("\n", "", $html);
$rows = explode("<br />", $html);

$row_num = array();
$i = 1;

foreach($rows as $row) {
if($i < 10) {
$i = "0".$i;
}

if($i==1) {
$row_num[] = "<tr><td><code><font color=\"#000000\"><code>$i</code></font>\t$row</code></td></tr>";
}

if($i!=1) {
if(is_int($i/2)) {
$row_num[] = "<tr bgcolor=\"#F9F9F9\"><td><code><font color=\"#000000\">$i</font>\t$row</code></td></tr>";
} else {
$row_num[] = "<tr><td><code><font color=\"#000000\">$i</font>\t$row</code></td></tr>";
}
}

$i++;
}
return "<pre>\nFilename: <b>$_GET[file]</b>\n<table
style=\"border:1px #000000 solid\">".implode($row_num)."</table></pre>";
}
?>

<< Back to user notes page

To Top