You are here: Re: [PHP] Newline character problem... « PHP « IT news, forums, messages
Re: [PHP] Newline character problem...

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация