Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any particular reason \n doesn't work?

Status
Not open for further replies.

james0816

Programmer
Jan 9, 2003
295
US
I thought this was for advancing a line yes/no?

echo "HI!\n";
echo "BYE!";

should produce:

HI!
BYE!

instead i get:

HI! BYE!
 
trying to advance to the next in a text file.

So far I have used \n which is doing nothing
and even tried <br /> but that is writing <br /> to the text file.
 
you need to be sure that you are viewing the file in a compatible reader. windows notepad likes "\r\n" whereas linux terminators are "\n".

use crimson editor or similar on a windows platform

or use the built in constant PHP_EOL as the line terminator
 
best way i have found is

echo "<br>";

works well and easy to spot when making chages

David Lerwill
&quot;If at first you don't succeed go to the pub&quot;
 
<br> is an html tag. the op was after a solution for text files.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top