PHP function used to read CSV files

No Comments

The below function can be used to read CSV files and returning an array with all values obtained from the CSV file

USAGE:

Copy the below function to your PHP script

function readCSV($csvFile){
 
 
        $file_handle = fopen($csvFile, 'r');
 
        while (!feof($file_handle) ) {
 
                $line_of_text[] = fgetcsv($file_handle, 1024);
 
        }

Image Credits: Photo by Isis França on Unsplash.

Related Articles

No results found

Leave a Reply

avatar
  Subscribe  
Notify of
Menu
Copy link