Page 1 of 1

Control Characters Having no Effect

Posted: Sun Nov 05, 2006 1:07 am
by Gurson
Hi,

I'm new to PHP.
I tried to find answers to these on the web, but couldn't find such.
I use PHP 5.2 on Win XP, Abyss and KFWS servers.

When I use the Print or Echo functions, in the double-quote form,
the control characters (i.e. \n,\r) have no effect on the text output.
For example, thee two will have the same output on my display:
(a) print("Hello World!\nHow are you ?")
(b) print("Hello World!How are you?")

Thanks,
Gurson.

Re: Control Characters Having no Effect

Posted: Sun Nov 05, 2006 2:24 am
by Zoxive
Gurson wrote:Hi,

I'm new to PHP.
I tried to find answers to these on the web, but couldn't find such.
I use PHP 5.2 on Win XP, Abyss and KFWS servers.

When I use the Print or Echo functions, in the double-quote form,
the control characters (i.e. \n,\r) have no effect on the text output.
For example, thee two will have the same output on my display:
(a) print("Hello World!\nHow are you ?")
(b) print("Hello World!How are you?")

Thanks,
Gurson.
Look in the source code of created page. HTML ignores spaces..

put '<pre>' and '</pre>' around that and see what happens.

-Zoxive

Posted: Sun Nov 05, 2006 4:44 am
by timvw
Apart from <pre> you could also have a look at http://www.php.net/nl2br. Btw, this is not the right forum to ask stuff like this.

Posted: Sun Nov 05, 2006 2:00 pm
by Gurson
Hi again,

Thanks for your help.
It does work now :) .
Next I try to address my questions better.