Posted By

iloveitaly on 08/24/11


Tagged

php csv


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

guillermoj88gmailcom
tux-world


PHP Read CSV to Array


 / Published in: PHP
 

  1. function read_csv_file($file) {
  2. $file = fopen($file, 'r');
  3. $csv = array();
  4.  
  5. while (($line = fgetcsv($file)) !== FALSE) {
  6. $csv[] = $line;
  7. }
  8.  
  9. fclose($file);
  10. return $csv;
  11. }

Report this snippet  

You need to login to post a comment.