> Date: Mon, 9 Mar 2009 13:28:19 +0100 > From: jochem@xxxxxxxxxxxxx > To: stuttle@xxxxxxxxx > CC: ajwei@xxxxxxxxxxxxx; php-general@xxxxxxxxxxxxx > Subject: Re: Line Break Problem > > 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. Hi, all: Thanks to all who replied. It looks like that a simple <pre> tag works great. Looks like I didn't realize that \r\n does not reflect itself to the screen. Alice _________________________________________________________________ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail