Skip to content

Fix/increment headers sequential suffix - #19

Closed
gomcodoctor wants to merge 8 commits into
portphp:masterfrom
gomcodoctor:fix/increment-headers-sequential-suffix
Closed

gomcodoctor wants to merge 8 commits into
portphp:masterfrom
gomcodoctor:fix/increment-headers-sequential-suffix

Conversation

@gomcodoctor

Copy link
Copy Markdown

No description provided.

gomcodoctor and others added 8 commits November 17, 2022 13:14
customized reader file
return type added
auto_detect_line_endings removed
"portphp/portphp": "dev-master"
trim white space in header added
array_count_values() groups every occurrence of a repeated header
together in the output, based on that header's first-appearance order
in the input - not the position it actually appeared at. For headers
like ['a', 'b', 'a', 'c'] this produces ['a', 'a1', 'b', 'c'], which no
longer lines up column-for-column with the CSV row's actual values at
those same indexes.

Walk $headers in original order instead, incrementing a per-header
counter as each duplicate is encountered, so the incremented headers
array stays positionally aligned with the row data: ['a', 'b', 'a1', 'c'].
@gomcodoctor

Copy link
Copy Markdown
Author

merged

@gomcodoctor gomcodoctor reopened this Sep 18, 2026

@gomcodoctor gomcodoctor left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant