I am trying to write an array in to string which is then written to a text file
I am using implode() on the array and using fputs this string is written to my text file-
so far so good
However in my text file there is a line break after each entry,which i need to get rid of
(This is not /r or /n but a pysicalline break)
As this file is be readmy another application my string needsto written all on 1 line of the text file-
code-
$cat1text is the array
$cat1text = implode(",",$cat1text);
$fp = fopen("cat1text.txt", "w");
fputs($fp,$cat1text);
fclose($fp);
output-
item1
,item2
,item3
,item4
this is what I want
item1,item2,item3