|
Posted by rf on 05/28/07 03:15
"Michael" <MichaelDMcDonnell@yahoo.com> wrote in message
news:1180319398.779675.292260@j4g2000prf.googlegroups.com...
> 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>") ?
Yes.
More properly
printf("Hello world! <br>\r\n");
so you get a line break in the source HTML as well, making it easier to
read.
or, since you are not actually formatting anything:
print("Hello world! <br>\r\n");
or even
echo "Hello world! <br>\r\n";
--
Richard.
Navigation:
[Reply to this message]
|