1function csvToArray($filename = '', $delimiter = ',')
2{
3 if (!file_exists($filename) || !is_readable($filename))
4 return false;
5
6 $header = null;
7 $data = array();
8 if (($handle = fopen($filename, 'r')) !== false)
9 {
10 while (($row = fgetcsv($handle, 1000, $delimiter)) !== false)
11 {
12 if (!$header)
13 $header = $row;
14 else
15 $data[] = array_combine($header, $row);
16 }
17 fclose($handle);
18 }
19
20 return $data;
21}
22