= 2) $csv_file = $argv[1]; if (count($argv) >= 3) $output = $argv[2]; if (!is_file($csv_file)) die("CSV file '$csv_file' not found.\n"); if ($output) { if(is_file($output)) die("Output file '$output' already exists.\n"); } else echo "No output file specified: export on STDOUT\n"; $rows = load_csv_file($csv_file); echo "Handle CVS file rows... "; $type_entite = array(); foreach($rows as $row) { if (!$row['Code'] || !$row["Libellé du type d'entité"]) continue; $type_entite[$row['Code']] = mb_ucfirst(trim($row["Libellé du type d'entité"])); } echo "done.\n".count($type_entite)." type(s) entite(s) found.\n"; if ($output) { $ofd = fopen($output, 'w') or die("Fail to open output file '$output'.\n"); } else { $ofd = STDOUT; } $stats = stat($csv_file); fwrite($ofd, "