Question about \n...

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
Pestilence
Forum Newbie
Posts: 2
Joined: Wed May 29, 2002 3:53 pm

Question about \n...

Post by Pestilence »

I'm trying to send some pipe-delimited text lines to a file and place a newline at the end of each line. In the future I may also want to change this function to output html to the file, so i've built the routine so that I can specify the delimiter and line end strings so that they can be replaced with <tr>,<td>,</td>,</tr>, etc... When I do this:

Code: Select all

$EndLine = "\n";
fwrite($fp, $BeginLine.$FirstPart.$Sep1."D".$Sep2.$SecondPart.$Endline);
it doesn't write the newline characters to the file, yet when I do this:

Code: Select all

fwrite($fp, $BeginLine.$FirstPart.$Sep1."D".$Sep2.$SecondPart."\n");
it does... why?
Anthron
Forum Newbie
Posts: 8
Joined: Mon May 20, 2002 6:25 pm
Location: usa
Contact:

Re: Question about \n...

Post by Anthron »

watch closely:

Code: Select all

$End&#1111;b]L&#1111;/b]ine = "\n";
fwrite($fp, $BeginLine.$FirstPart.$Sep1."D".$Sep2.$SecondPart.$End&#1111;b]l&#1111;/b]ine);
Isn't php case sensitive? wouldn't that have to be an uppercase ;?
Pestilence
Forum Newbie
Posts: 2
Joined: Wed May 29, 2002 3:53 pm

OMFG!!!

Post by Pestilence »

:oops: oi - i'm obviously a relative n00b here... thanks much and sorry for clogging the forum up with this one :D
Post Reply