generate functionFri, 27 Jan 2023

import csv from local file and save it into an array

<? $row = 1; $array = array(); if (($handle = fopen("file.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); $row++; for ($c=0; $c < $num; $c++) { $array[$row][$c] = $data[$c]; } } fclose($handle); } ?>

Questions about programming?Chat with your personal AI assistant