Created
February 2, 2015 08:53
-
-
Save steffen-wirth/31d06cd35684ee7336dd to your computer and use it in GitHub Desktop.
csv table to array with column headers as keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$all_rows = array(); | |
$header = null; | |
while ($row = fgetcsv($file)) { | |
if ($header === null) { | |
$header = $row; | |
continue; | |
} | |
$all_rows[] = array_combine($header, $row); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment