You are here: Re: newbie question: can't make newline character work in echo « PHP Programming Language « IT news, forums, messages
Re: newbie question: can't make newline character work in echo

Posted by Jerry Stuckle on 03/21/06 21:08

Stephen Kay wrote:
> learning php here - I'm echoing some debug code, and I cannot seem to make
> the newline character work.
>
> For example, I tried this:
>
> echo "supposedly, this will \nbe on \nmultiple lines.";
>
> which, according to the php manual, should produce this:
>
> supposedly, this will
> be on
> multiple lines.
>
> But it doesn't work! It's all on the same line. What obvious thing am I
> missing?
>

Display your html source. You'll see the newlines there.

This isn't a PHP problem - it's how HTML works. Newline characters are
ignored. Instead, you need to use <br> to start a new line.
See the nl2br() function.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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