PHP:CSV

De WikiMar
Dreceres ràpides: navegació, cerca

<syntaxhighlight lang="php"> if (is_file($file)) {

  $file_handle = fopen($file, "r");
  $row = 0;
  while (($liniaEntrada = fgetcsv($file_handle, 2000, ",", '"')) !== FALSE) {
       $row++;
       $num = count($liniaEntrada);
       if ($num > 30) //number of columns expected
       {
       ...
       }
  }
  
  fclose($file_handle);

}

</syntaxhighlight>