faqts : Computers : Programming : Languages : PHP : Common Problems : Files

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

24 of 59 people (41%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I create DOS style new lines in PHP?
Why are all my new lines messed up when I create a file for DOS / Windows?

May 15th, 2000 20:43
Nathan Wallace, Mark Roedel, Richard Lynch


If you're just ending each line with a "\n", you might try changing that
to "\r\n".  Just like in C, the \n is a newline, or linefeed (LF), while
the \r is a carriage return (CR).

So, you'll need to use something like:

    fwrite("...\r\n");

or

    fputs("...\r");

to get the \r in there for DOS.