Monday, June 8, 2009

csv file to an array

$row = 1;
$handle = fopen("test.csv", "r");
while ((
$data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo
"

$num fields in line $row:

\n"
;
$row++;
for (
$c=0; $c < $num; $c++) {
echo
$data[$c] . "
\n"
;
}
}
fclose($handle);
?>

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails