>
> Use the tool that PHP provides for such problems.
>
> http://php.net/fgetcsv



fgetcsv is very useful, here a example:

<?php
$row = 1;

/* load file*/
$handle = fopen("log.csv", "r");

/* read line by line */
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $num = count($data);
    echo "<p> $num fields in line $row: <br /></p>\n";
    $row++;
    for ($c=0; $c < $num; $c++) {
        echo $data[$c] . "<br />\n";
    }
}

fclose($handle);
?>

-- 
Gerardo Benitez

Reply via email to