I'm writing note software in PHP (to store notes) and most often I include code within, when I fetch the note from the database it collapses all whitespace I assume, so any code blocks look ugly. (I nl2br()
it, I mean horizontal space)
What would be the most efficient way to deal with this? I think the database entry keeps the spaces, so would replacing all spaces with
be the only solution PHP-display-side? (ugly for long long entries), what are your thoughts on how I can accomplish this taking in mind the code may be 1-16M characters long?
It shouldn't be collapsing all whitespace. Try outputting it inside <pre>
tags to see that white space.