• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP Source Highlighting?

How do I do that?? :confused:

Anyway, I though there was a way of saving it, then you open it and it shows the source with highlighted syntax...
 
with this function ( from php.net ):
PHP:
function showsource ($code) {
    ob_start();
    highlight_string($code);
    $colorsource = ob_get_contents();
    ob_end_clean();
    
    $colorsource = str_replace (" ", " ",
$colorsource);

    return $colorsource;
}
then you only need
echo showsource(your string);
 
How would I with a file? I do highlight_file() with my file name and it says an error on line 94.... Do I have to open the file etc..?
 
Parse error: parse error, unexpected $ in d:\programs\easyphp\www\new\highlight.php on line 94

highlight.php:
<?php
highlight_file("display.php");
?>
 
Back
Top