steffen-wirth
2/2/2015 - 8:53 AM

csv table to array with column headers as keys

csv table to array with column headers as keys

$all_rows = array();
$header = null;
while ($row = fgetcsv($file)) {
    if ($header === null) {
        $header = $row;
        continue;
    }
    $all_rows[] = array_combine($header, $row);
}