Forum Moderators: coopster

Message Too Old, No Replies

creating an array from a csv file

array from csv file

         

kevpatts

10:48 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



Hey all,

I need a bit of help creating an array from a vabialbe column number csv input file. The first row in the file are column headers. I'm trying to manually make the first line of the csv file:

$number,$mane,$min,$max,$allowed,$type,$description

import this as a string called $header_row and then use:

list(split(',',$header_row)) = split(',',$line)

to create variables OF the header row entries but the notation in wrong. Seeing as I don't know how many entries are in the $header_row string, how can I do this another way?

Thanks in advance,
Kevpatts

jatar_k

12:18 am on Jun 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so you want an associative array using as keys the values from header_row?

are there not place holders for missing values?

do the number of values in each row always reflect the number of entries in header? or is that what you mean by variable?