Re: Newline character problem...
| From: | ?ukasz Hejnak | Date: | Sat, 03 Dec 2005 07:21:09 +0000 |
| Subject: | Re: Newline character problem... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226807@lists.php.net to get a copy of this message | ||
Robert napisal(a):
I'm new to PHP but not programming in general. I have used C++ for a while and I'm familiar with the newline character as it's basically the same in PHP. This is the most basic of examples: print 'one' ; print "\n" ; print 'two' ; The output of this when accessed on my server is: one two It should be: oneHi well this isn't apache or php related, as it's webbrowser related, and even more, it's correct. The thing is, what You see in Your browser is an interpreted version of the html outputed by the php (obvious?), so if You do a html file, and put: one two in there, and view it with Your browser, it will still look like this: one two to get the expected (as in C/C++) result, You need to add a <br> or any other line breaking method in there (<p>one</p><p>two</p> is another one) Now, if You'd see the generated source code, You'd notice that there is in fact the line break as it should be :) so it is good to use '\n' to get the output code clear to read, for debugging and so.. Best wishes ?ukasz Hejnaktwo