Select Page

PHP function used to read CSV files

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);
 
        }

Related Articles

Last Updated On March 22, 2018

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.