Reply to Re: Copying a CSV file and changing a column of data

Your name:

Reply:


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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация