Re: implode help
| From: | Andrey Hristov | Date: | Mon, 05 Nov 2001 19:26:53 +0000 |
| Subject: | Re: implode help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73472@lists.php.net to get a copy of this message | ||
$cat1text = str_replace("\r\n",implode(",",$cat1text));
$fp = fopen("cat1text.txt", "w");
fputs($fp,$cat1text);
fclose($fp);
I've the same problem today - getting csv file from Windows and using it on
Linux. Hope this helps.
--
Andrey Hristov
Web Developer
Icygen Corporation
BUILDING SOLUTIONS
http://www.icygen.com
On Monday 05 November 2001 07:17 am, you wrote:
> 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
>
>
> Any Ideas?
>
> Thanks In Advance