Control Characters Having no Effect

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Gurson
Forum Newbie
Posts: 2
Joined: Sun Nov 05, 2006 12:44 am

Control Characters Having no Effect

Post 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.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Control Characters Having no Effect

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
Gurson
Forum Newbie
Posts: 2
Joined: Sun Nov 05, 2006 12:44 am

Post by Gurson »

Hi again,

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