Created
September 1, 2017 05:15
-
-
Save devuri/7f32e03e3bfd67caa93183cc3ce19015 to your computer and use it in GitHub Desktop.
convert a csv file to array very pretty
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
<?php | |
function dve_csv_array($csvfile = 'samplecasvdata.csv',$cn=0,$before = '<br/>',$after = '<br/>'){ | |
$csv = array_map('str_getcsv', file($csvfile)); | |
foreach($csv as &$cell){ | |
echo $before.$cell[$cn].$after; | |
} | |
} | |
dve_csv_array('nir.csv',0,' "','"'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment