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