Reply to Re: Linked lists or arrays with many dimensions

Your name:

Reply:


Posted by Tyrone Slothrop on 11/24/05 03:30

On Wed, 23 Nov 2005 23:15:24 GMT, "Jon"
<jon@thisisafakeaddressignoreit.com> wrote:

>Hi,
>
>I have a csv file which contains rows with the following fields:
>
>category1,category2,category3,data1,data2,data3
>
>What is the simplest way to parse the rows?
>
>I'd like to count the number of category2's per item in category3. Number
>of category3's per category2 item etc...
>
>I know this could be done with a database, but I don't have a database on my
>server.
>
>Kind Regards,
>
>Jon.
>

One way to do it:

$data = file ("file.csv");
foreach ($data as $line)
{
list (category1,category2,category3,data1,data2,data3) = split(',',
$line);
}

Or, if you want to treat as an array:

foreach ($data as $line)
{
$record[] = explode(',', $line);
}

[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

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