Re: Parse Question Using list()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux