so i have the following code:
myarray[1] = item1, element1, element2
myarray[2] = item2, element1, element2
$outfile = "csv.txt";
$filewriter = fopen($outfile, "w"); // open for write
foreach($myarray as $item) {
fwrite($filewriter, $item);
}
which produces the following in the txt file:
item1,element1,element2item2,element1,element2
if i try to use "\n" it produces this output:
item1,element1,element2
(blank line)
item2,element1,element2
how do i get it too:
item1,element1,element2
item2,element1,element2
This is the \n
function writetofile($myarray){
$outfile = "csv.txt";
$filewriter = fopen($outfile,"w"); // open for write
$item=$myarray[0]."\n".$myarray[1];
fwrite($filewriter, $item);
Thanks