Page 1 of 1

PHP CODE - TO create a new line in a text file

Posted: Sun Jan 10, 2010 11:05 am
by dudelondon
I'm trying to create a text file in php to generate some playlist.

The problem is that I cannot manage to create a new line in the text file. Using /n still places text in the same line and just inserts a symbol to indicate the 'new line'. Using <br> just works when viewing the document in HTML (which is not what i need in this case). But what I want is to physically insert a new line in the text file so that when i open the generated file using notepad i see that there are actually new lines in the document and so that the playlist can be read normally with a music player.

Have tried single and double quotes, foward and backward slashes...but nothing seem to work.

Any help would be appreciated! 8)

Thanks
Jimmy

Re: PHP CODE - TO create a new line in a text file

Posted: Sun Jan 10, 2010 11:09 am
by AbraCadaver
The correct escape for a newline is \n however this won't show a newline in notepad because windows uses \r\n for newlines. I think wordpad or notepad++ will show the newline with just \n.