Created
January 25, 2025 22:13
-
-
Save draobrehtom/08fd9326ed4f73086eafae3b5c7abc25 to your computer and use it in GitHub Desktop.
Creates unique keys by combining specified row values Maps those keys directly to their corresponding rows Provides more flexibility Significantly improves performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected function mapReportDataByKeys(array $data, array $keys, ?string $delimiter = '-'): array | |
| { | |
| return array_combine( | |
| array_map( | |
| fn($row) => implode($delimiter, array_map(fn($key) => $row[$key], $keys)), | |
| $data | |
| ), | |
| $data | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment