not able to echo a new line using \n<

liunx

Guest
HI,
I am not able to echo a new line using

echo "\n";

I'v also tried giving

echo "\r\n"; and

echo "\r";

none of them worked...but instead of a new line it is giving a space.
I am writing code on a window XP system and the apache server is on a linux terminal....using SSH to upload the file from my system to the server.
Please help me,
regards
chanduyou can't echo a new line like that. that is for the source of the code when you look at it. a new line is a break tag <br />

echo "<br />\n";
echo "<br />\n";

that will show like this in the source

<br />
<br />

but if you takew the \n off it will show like this

<br /><br />

get it?It works,
Thanx very much....
by the way your avathar is the cute monster i'v ever seen...
regards
chanduOriginally posted by t_ravichandu
It works,
Thanx very much....
by the way your avathar is the cute monster i'v ever seen...
regards
chandu

:rofl:Originally posted by t_ravichandu
by the way your avathar is the cute monster i'v ever seen...
regards
chandu Oh, yeah. He's cute alright :D

Here coochy coochy coo. Who wants a bwig cuddly wuddly :PBut guys...I have seen using just \n for a new line in a lot of occassions. It is also given in PHP manual from PHP.net....
any clues.....:confused:Use it when writing flat files or when you want newlines to appear in a text field.

As Scoutt says, not for creating newlines in HTML documents as these are created using <br> (or <br /> if you wish to be XHTML compliant).
 
Back
Top