@NogDogMar 12.2010 — #Not sure I understand the question, but perhaps at least part of the answer is [url=http://php.net/highlight_string]highlight_string[/url]()?
@MindzaiMar 12.2010 — #So which part is giving you issues? As NogDog has mentioned, highlight_string() will give you the syntax highlighting (as will GeSHi if you want something more advanced).
@MindzaiMar 12.2010 — #There's nothing in the code you posted which is converting newline and/or carriage return characters into <br /> tags. You need to locate whatever code is doing that (a nl2br() call somewhere?) and stop it. You [I]could[/I] replace the <br /> tags of course, but that's problematic if the php code contains such a tag itself, which is why I suggest tracking down the source of the <br />.