Mitul Dabhi
answered Nov 30 '-1 00:00
fgets also used to read the csv
fgets read the line from the current file pointer . and then explode the line by comma separator by explode function .
function readCsv($filename){
$row = 1;
if (($handle = fopen($filename, "r")) !== FALSE) {
while (($line = fgets($handle, 1000, ",")) !== FALSE) {
$data=explode(",",$line);
$cSvdata[]=$data;
$row++;
}
fclose($handle);
return $cSvdata;
}
}
readCsv("user.csv");
readcsv function here read the csv file and give use output in array format