fgetcsv
Posted: Wed Jul 24, 2002 6:12 pm
First of all, I'd like to congratulate you guys on having a great php resource. I'll be a faithful follower of this site from now to the end of my days.
I've been working on learning php, and am finding it an extremely useful web language. During my practices, I was fooling the the fgetcsv command and wondered if this php code (taken from php.net) would also be used to create a column array and how. If it can't, does anyone have any ideas as to how I'd be able to reference both row and column arrays?
$row = 1;
$fp = fopen ("test.csv","r");
while ($data = fgetcsv ($fp, 1000, ",")) {
$num = count ($data);
print "<p> $num fields in line $row: <br>";
$row++;
for ($c=0; $c < $num; $c++) {
print $data[$c] . "<br>";
}
}
fclose ($fp);
I've been working on learning php, and am finding it an extremely useful web language. During my practices, I was fooling the the fgetcsv command and wondered if this php code (taken from php.net) would also be used to create a column array and how. If it can't, does anyone have any ideas as to how I'd be able to reference both row and column arrays?
$row = 1;
$fp = fopen ("test.csv","r");
while ($data = fgetcsv ($fp, 1000, ",")) {
$num = count ($data);
print "<p> $num fields in line $row: <br>";
$row++;
for ($c=0; $c < $num; $c++) {
print $data[$c] . "<br>";
}
}
fclose ($fp);