×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Bob Ray
Added: Jul 16, 2015 10:22 PM
Modified: Jul 16, 2015 10:35 PM
Views: 13
Tags: file read csv
Iterate through lines of a CSV file
  1. /* Original code by Mohit Madan @TheMohitMadan */
  2. function readCSV($csvFile){
  3.         $file_handle = fopen($csvFile, 'r');
  4.         while (!feof($file_handle) ) {
  5.                 $line_of_text[] = fgetcsv($file_handle, 1024);
  6.         }
  7.         fclose($file_handle);
  8.         return $line_of_text;
  9. }