Reputation: 123
I have a form,i want to take value from form and check this value to the value in csv file. But it can be in any of the multiple csv files.
So how can i traverse through multiple csv files
For example, I have 50 csv files i want to traverse through these 50 csv files until i get the appropriate result.
I know how to traverse through 1 csv file code i used for this is written below
<?PHP
function readCSV($csvFile){
$file_handle = fopen($csvFile, 'r');
while (!feof($file_handle) ) {
$line_of_text[] = fgetcsv($file_handle, 1024);
}
fclose($file_handle);
return $line_of_text;
}
// Set path to CSV file
$csvFile = 'test.csv';
$csv = readCSV($csvFile);
echo '<pre>';
print_r($csv);
echo '</pre>';
?>
Like this how can i traverse through multiple csv files.
Upvotes: 1
Views: 501