Stuart schreef: > 2009/3/9 Alice Wei <ajwei@xxxxxxxxxxxxx> > >> I have a question regarding using line breaks in PHP. I have the code >> something like: >> >> echo "1" . "\t " . $x . "\t" . $y . "\r\n"; >> >> When I run the code, it looks like a whole blob of text, but when I use >> "View Source", the line breaks are formatted then correctly. >> Anyone can please tell me if this is what this is supposed to be? >> If so, how can I get the user to see the line break as they are, do I have >> to use <br>? > you can also wrap the output in question in a <pre> tag: <pre> 1 X Y 2 X Y </pre> alternatively use the nl2br() function ... but that won't help with displaying the tabs. note that there is a difference between the output of your script (which you can view using 'View Source' when the output is sent to the browser) and the representation of that same source (by which I mean how the the source is rendered [in the browser, in this case). HTML rendering ignores tabs, carriage returns and multiple consecutive spaces found in the source (with the exception of the <pre> tag, possibly the <code> tag, additionally the CSS attribute 'whitespace', IIRC, can be used to force rendering all whitespace chars. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php