= 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... "; $diplomes = array(); foreach($rows as $row) { if (!$row['DIPLOME_SISE'] || !$row['LIBELLE_INTITULE_1']) continue; $diplomes[strval($row['DIPLOME_SISE'])] = trim($row['LIBELLE_INTITULE_1']); if ($row['LIBELLE_INTITULE_2']) $diplomes[$row['DIPLOME_SISE']] .= ' - '.trim($row['LIBELLE_INTITULE_2']); } echo "done.\n".count($diplomes)." diplome(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, "