Can anyone share a resource (download or a how-to) for parsing a CSV to an associative array based on the first row of the CSV acting as the column names?
I found this resource http://blog.joshuamcginnis.com/2008/12/csv-to-associate-array/ but can't make heads or tales about the second parameter sent to the function.
In case you're unsure what I am speaking of, look at this.
CSV file
John,Smith,555-1212
would explode to
array (
[0] => John,
[1] => Smith,
[2] => 555-1212
}
With the appropriate script, I want to take
CSV file
firstName,lastName,homePhone
John,Smith,555-1212
would explode to
array (
[firstName] => John,
[LastName] => Smith,
[homePhone] => 555-1212
}
Good of you to take time to read this.