[RESOLVED] Great for \n nl2br but what about keeping indents?
Hello I'm a little lost on this, I'm displaying the output of a tutorials system and am use htmlentities() and nl2br however when users post information like the body of the tutorial and say it has a piece of code like:
Code:
If blah = blah
Look here, this is indented
end if
but the output makes it appear flat like
Code:
If blah = blah
Look here, I'm FLAT
end if
how can I keep any spaces before the start of a string for each line, how can I retrieve that indent????
Re: Great for \n nl2br but what about keeping indents?
\t is used for tab. In one script I used, I just striped out the \n and replaced it with <br>, you can do the same with this, replace \t with 5 nbsp;.
Re: Great for \n nl2br but what about keeping indents?
works perfectly now, thanks dude