Heh, beat me to it bad76 🙂
Exactly tho, use nl2br if you are barfing blocks of text to the screen, but if you need full pre-formatted text, you should be using <pre></pre>, or any random tag with a little CSS applied:
<div style="white-space: pre;">
If you still want to not use pre-tags, and want your spaces preserved, just do something like:
$output = str_replace(' ',' ',$input);
Note: remember, if Joe User decides to use like 400 spaces ( &nbsp; ) in a row, your page width will stretch too, using either method.