|
Posted by ?ukasz Hejnak on 10/21/69 11:34
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
Navigation:
[Reply to this message]
|