Page 1 of 1

[SOLVED] Simple question about using fwrite()

Posted: Sat Apr 17, 2004 3:05 pm
by joetheeskimo5
How can I do a line break while writing to a file with fwrite()? I tried using the \n symbol, but it generated parse errors. Can anyone help?

Thanks!
Joe

Posted: Sat Apr 17, 2004 4:33 pm
by kettle_drum
fwrite($fp, "\n\r"); should work fine. What is the error you get?

Posted: Sat Apr 17, 2004 4:36 pm
by tim
if your are using single quotes, use double:
$content = "tim \n tim \n";
below wouldnt work:
$content = 'tim \n tim';

also try: \r\n

Posted: Sun Apr 18, 2004 12:04 pm
by joetheeskimo5
Ohh, my problem was that I didn't you know you could put the \n straight into the quotes, i did it like this:

"Blah".\n."blah"

When I should have done:

"Blah \n Blah"

Thanks! :)

~Joe