\n question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

\n question

Post by Sevengraff »

I use \n a lot, but when I view the file's source, PHP doesn't put things on a new line, all the editors see is a box. Is there another way to do a carrage return?
User avatar
EvilWalrus
Site Admin
Posts: 209
Joined: Thu Apr 18, 2002 3:21 pm
Location: Springmont, PA USA

Post by EvilWalrus »

what editor are you using?
User avatar
sam
Forum Contributor
Posts: 217
Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:

Post by sam »

The new line characters used by windoes is \r\n rather than just the \n used by windows... So if you are viewing the file with a windows editor it will not skip to the next line...

Sam

PS Macintost uses \r
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

Yup use \r\n and you'll be fine.
I had the same problem and haven't encoutered it since I switched from \n to \r\n.

and thx for the explanation sam I didn't have the problem on my unix server/host but only on my windows system on which I write my scripts.. now I understand it ;)
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

Thanks, that will help!
Post Reply