Page 1 of 1

Easy file question

Posted: Sat May 17, 2003 10:15 pm
by Doolittle
I've searched a bunch of places but haven't had much luck... How would you write into a file with multiple lines... lets say from an array and each
part of the array has its own line... I believe I have done it before I have
just completely forgotten how to!

I've tried using the "\n" and still doesn't work...

Here is my code:

Code: Select all

$xї0] = "Hello";
$xї1] = "waldo";

$x = implode("\n", $x);

$fp = fopen("x.txt", "wt");
fwrite($fp, $x);
fclose($fp);
Thanks in advance!

Posted: Sun May 18, 2003 4:56 am
by volka
\n should do the trick.
How and where (OS) do you open/read x.txt again?