Re: whaw
| From: | Andrei Reinus | Date: | Mon, 24 Nov 2003 13:27:18 +0000 |
| Subject: | Re: whaw | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170785@lists.php.net to get a copy of this message | ||
pete M wrote:
Even the pros systems crash sometimes http://www.php.net/// Highlight PHP code function highlight_php($code, $return = FALSE) { // Using OB, as highlight_string() only supports // returning the result from 4.2.0 ob_start(); highlight_string($code); $highlighted = ob_get_contents(); ob_end_clean(); // Fix output to use CSS classes and wrap well $highlighted = '<div class="phpcode">' . str_replace(
array(
' ' *<--- insert coma ?!?!?*
'<br />',
'<font color="',
'</font>',
"\n ",
' '
),
array(
' ',
"<br />\n",
'<span class="',
'</span>',
"\n ",
' '
),
$highlighted
) . '</div>';
if ($return) { return $highlighted; }
else { echo $highlighted; }
}