You are here: Re: fgetcsv delimiters « PHP Programming Language « IT news, forums, messages
Re: fgetcsv delimiters

Posted by NC on 03/12/06 00:41

Stephen Preston wrote:
>
> I have an xls worksheet I wish to export as a text or csv file
> to import with fgetcsv()

So go ahead and do it; there shouldn't be any problems...

> The 'save as' function on excell lets me save as a comma
> separated value or tab delimited text files.
> Trouble is, some of my cells already have commas in them

Doesn't matter; Excel encloses fields with commas in them in double
duotes, like this:

A simple field,"A field with a comma (,) in it",Another simple field

fgetcsv() understands this as well...

> a tab or something else would be better.

This is a matter of opinion... :)

> In the delimiter option of fgcsv(), can you specify a tab

You can if you want to:

fgetcsv($handle, 10240, "\t");

Note that since a custom delimiter is the third argument, the second
argument (the maximum length of a CSV string) must be specified...

For more information, see documentation on fgetcsv():

http://www.php.net/fgetcsv

Cheers,
NC

 

Navigation:

[Reply to this 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

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