 <p>I think, your problem is this line:</p> <pre><code> $forwardformat = str_replace(" ","",$forward); </code></pre> <p>This only matches the space-character. Tab, Newline etc. are not replaced (and do not really show in your (html-)output when echoing the result. Thus i recommend, you try</p> <pre><code> $forwardformat = preg_replace('/\s+/','',$forward); </code></pre> <p>HTH</p> <p>Argelbargel</p>