Edit report at https://bugs.php.net/bug.php?id=23253&edit=1
ID: 23253 Updated by: yohg...@php.net Reported by: gk at proliberty dot com Summary: highlight_string($string) removes newlines from input string -Status: Open +Status: Verified Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues -Operating System: linux +Operating System: * -PHP Version: 4.3.2RC1 +PHP Version: master Block user comment: N Private report: N New Comment: Current PHP doesn't add linefeed as reporter said. However, we do not have to change behavior as highlighted source is for browsers, not human. Left this report open, in case someone would like to change behavior. Previous Comments: ------------------------------------------------------------------------ [2003-04-17 02:06:09] gk at proliberty dot com If you use highlight_string() to produce HTML formatted source, the output string replaces newlines with <br \>. This is very ugly and unnecessary. Whitespace is an important part of code; readability is not an insignificant feature. Instead, "\n" should be replaced with "<br \>\n", or "<br>\n", to be HTML compliant. <?php // $source_file includes line breaks $source=join('',file($source_file)); $body=highlight_string ( $source, $return=TRUE); // $body is a single line, without line breaks ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=23253&edit=1