note 19326 deleted from function.highlight-string by didou
| From: | didou@php.net | Date: | Sat, 16 Aug 2003 23:47:28 +0000 |
| Subject: | note 19326 deleted from function.highlight-string by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54517@lists.php.net to get a copy of this message | ||
Note Submitter: eric@evilwalrus.com
----
When your highlighting code using highlight_string() it tends to add a lot of
(non-breaking spaces) to the code. This can tend to mess up tables that don't have a set width.
A workaround for now is to remove all of those spaces.
<?
function showsource ($code) {
ob_start();
highlight_string($code);
$colorsource = ob_get_contents();
ob_end_clean();
$colorsource = str_replace (" ", " ", $colorsource);
return $colorsource;
}
$plain_code = "<? phpinfo(); ?>";
echo showsource($plain_code);
?>
I don't think this will totally solve the problem, but it does help.