Friday 2 August 2019

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

0 comments:

Post a Comment