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

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
dudelondon
Forum Newbie
Posts: 2
Joined: Thu Dec 10, 2009 4:41 am

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

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

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

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply