Skip to content

Instantly share code, notes, and snippets.

@WangMagic
WangMagic / parse-csv.php
Last active February 22, 2019 13:56 — forked from benbalter/parse-csv.php
Parse CSV into Associative Array
<?php
$lines = explode( "\n", file_get_contents( 'input.csv' ) );
$headers = str_getcsv( array_shift( $lines ) );
$data = array();
foreach ( $lines as $line ) {
//Skip if it's just a blank line
if(empty($line)){
continue;
}