Re: Newline character problem...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: one
                   two

Hi
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 Hejnak

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux