fgetcsv
Gets line from file pointer and parse for CSV fields
Description
arrayfgetcsv
intfp
intlength
stringdelimiter
Similar to fgets except that
fgetcsv parses the line it reads for fields
in CSV format and returns an array containing
the fields read. The field delimiter is a comma, unless you
specify another delimiter with the optional third parameter.
Fp must be a valid file pointer to a file
successfully opened by fopen,
popen, or fsockopen
Length must be greater than the longest
line to be found in the CSV file (allowing for trailing line-end characters).
fgetcsv returns &false; on error, including
end of file.
A blank line in a CSV file will be returned as an array
comprising a single &null; field, and will not be treated as an
error.
fgetcsv example - Read and print entire
contents of a CSV file
$num fields in line $row:
";
$row++;
for ($c=0; $c < $num; $c++) {
print $data[$c] . "
";
}
}
fclose ($fp);
]]>