CSV

PHP File Function: CSV

Load the csv file and use the first line as the array keys

try {
    $csv_file = fopen('path/to/file.csv', 'r');
    $csv_headers = fgetcsv($csv_file);

    while ($line = fgetcsv($csv_file)) {
        $csv_data_with_key = array_combine($csv_headers, $line);
        // do something with $csv_data_with_key
    }

} finally {
    fclose($csv_file);
}

Refernece