We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using the CSVReader with the option
$this->setHeaderRowNumber ( 0, CsvReader::DUPLICATE_HEADERS_INCREMENT );
then the column-name does not fit to the result anymore...
Here is my suggestion to solve the problem:
/** * Overriding default function * * @param array $headers * * @return array */ protected function incrementHeaders(array $headers) { $incrementedHeaders = array(); // Get all headlines that are duplicate or more foreach ( array_count_values ( $headers ) as $header => $count ) { if ($count > 1) { $incrementedHeaders [$header] = 0; } } // Replace the headers with the new header name but keep the position ($key) in the array foreach ( $headers as $key => $headerName ) { if (isset ( $incrementedHeaders [$headerName] )) { $prefix = empty ( $headerName ) ? 'UNKNOWN' : ''; $headers [$key] = $prefix . $headerName . $incrementedHeaders [$headerName] ++; } } return $headers; }
The text was updated successfully, but these errors were encountered:
@stevenbuehner - why not create a pull request with your changes? Might be better
Sorry, something went wrong.
No branches or pull requests
When using the CSVReader with the option
then the column-name does not fit to the result anymore...
Here is my suggestion to solve the problem:
The text was updated successfully, but these errors were encountered: