You are here: Re: Newline (\n) in printf doesn't work? « PHP Programming Language « IT news, forums, messages
Re: Newline (\n) in printf doesn't work?

Posted by Michael on 05/28/07 03:15

On May 27, 8:05 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Michael wrote:
> > I'm new to PHP.
>
> > I see that PHP supports the C printf function, and I've seen examples
> > like printf("Hello world!\n"); however the newline character \n
> > doesn't work - i.e., it does not generate an HTML <br>, which I would
> > have expected - what it does is generate a newline in the html
> > generated text, but since the browser ignores blank lines, this
> > feature appears useless for most applications.
>
> >>From this arises two questions:
>
> > 1. I am misunderstanding something?
>
> > 2. What is the prescribed way of inserting a newline into a PHP
> > string? (Could it be printf("Hello world! <br>") ?
>
> > Thanks,
> > M. McDonnell
>
> It works fine. It generates a nl character, just as you asked it to.
> Look at your source code - you'll see the line break.
>
> If you want an HTML <br> or xthtml <br />, you need to code them
> yourself. PHP does not convert for you.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Hide quoted text -
>
> - Show quoted text -

Jerry,

Thanks for your reply. Yes, I looked at the source code, but no <br>,
all I get is a new line of white space, which as we know is ignored by
the browser.

 

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

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