Skip to content

Instantly share code, notes, and snippets.

View jetonr's full-sized avatar
🏠
Working from home

Jeton R. jetonr

🏠
Working from home
View GitHub Profile
@jetonr
jetonr / array_from_csv.php
Created October 26, 2014 23:53
echo array from csv file
function world_cities(){
$csv = array_map( 'str_getcsv', file( plugin_dir_path( __FILE__ ) . 'data/countries_bordered1.csv', FILE_SKIP_EMPTY_LINES ) );
$headers = $csv[0];
unset($csv[0]);
$rowsWithKeys = [];
foreach ( $csv as $row ) {
$newRow = [];
foreach ( $headers as $k => $key ) {