generate functionFri, 27 Jan 2023

import csv from local file and put values into an array, then loop on each line of the array

$filename = 'index.csv'; if(!file_exists($filename)) { echo "The file $filename does not exist"; } else { $file = fopen('index.csv', 'r'); while(($csv = fgetcsv($file)) !== false): $line = implode(",", $csv); $line = str_replace('"', '', $line); $csv = explode(",", $line); // do somethings with $csv endwhile; fclose($file); }

Questions about programming?Chat with your personal AI assistant