I want to display code on the browser instead of executing it, so I use highlight_string,
<?php highlight_string('function foo(items) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu");
} // Real Tab.
}')?>
returns,
<code><span style="color: #000000"> function foo(items) { <br /> for (var i=0; i<items.length; i++) { <br /> alert(items[i] + "juhu"); <br /> } // Real Tab. <br />}</span> </code>
<code>
But I am after new lines without <br/>s,
<code><span style="color: #000000">
function foo(items) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu");
} // Real Tab.
}</span>
</code>
Is it possible?
You should be able to replace every
<br />tag with normal linebreaks (\r\n) and output your string, like this: