ConFoo Montreal 2026: Call for Papers

Voting

: four plus five?
(Example: nine)

The Note You're Voting On

starrychloe at oliveyou dot net
10 years ago
Based on James' line, this will create an array of associative arrays with the first row column headers as the keys.

<?php
$csv
= array_map('str_getcsv', file($file));
array_walk($csv, function(&$a) use ($csv) {
$a = array_combine($csv[0], $a);
});
array_shift($csv); # remove column header
?>

This will yield something like
[2] => Array
(
[Campaign ID] => 295095038
[Ad group ID] => 22460178158
[Keyword ID] => 3993587178

<< Back to user notes page

To Top