|
Posted by Schraalhans Keukenmeester on 04/03/07 23:39
laredotornado@zipmail.com wrote:
> Hi,
>
> I'm using php 4.4.4. I have a CSV file that contains columns "A" and
> "B". What is the simplest way to create a second CSV file with the
> values of column "A" copied into column "B"? The other columns in the
> file can be left alone.
>
> Thanks, - Dave
>
Read in the file contents line by line, explode() the lines using the
comma as the separator string, swap the resulting arrays' first two
cell's contents, join()/implode() the array items in a string with the
comma separator, write them to a new file, unlink the first, rename the
new one, done.
Something like that?
Best!
Sh.
Navigation:
[Reply to this message]
|