The following chunk of code may be included at the top of a file in order to do its own syntax highlighting. It's looking pretty good so far, except for a mysterious space before the first opening PHP tag in the output. Does anyone know why that space is there?
<? print '<html><head><style>'; // _ignore_ print 'body,font{font-family:Fixedsys} body{margin:0px}'; // _ignore_ print '.ln{margin:0px;margin-right:4px;padding:0px;padding-right:2px;text-alig n:right;color:#ffffff;background-color:#666666;width:45px;font-family:Fi xedsys;}'; // _ignore_ print '</style></head><body>'; // _ignore_ $contents = highlight_file(basename($_SERVER['PHP_SELF']), true); // _ignore_ $contents = explode('<br />', $contents); // _ignore_ $ln = 1; // _ignore_ foreach($contents as $line) if(!strstr($line, '_ignore_')) { print "<span class=ln>$ln</span>$line<br>"; $ln++; } // _ignore_ print '</body></html>'; // _ignore_ exit; // _ignore_ print 'Hello, cruel world. '; while(true) print 'God I love PHP. '; ?> If you want, put the above code in an include file (minus the "Hello, cruel world" stuff). Just don't forget to write "// _ignore_" after the include() or require() statement at the top of the target script. Matt