Skip to content

Instantly share code, notes, and snippets.

@emiflake
Created November 9, 2018 21:36
Show Gist options
  • Save emiflake/d6b5576030430ed9dea8f1c0c36cae82 to your computer and use it in GitHub Desktop.
Save emiflake/d6b5576030430ed9dea8f1c0c36cae82 to your computer and use it in GitHub Desktop.
function concat_map(array $arr, callable $f): array {
return array_reduce(array_map(function($k, $v) use ($f) {
return $f($k, $v);
}, array_keys($arr), $arr), function($acc, $v) {
return array_merge($acc, $v);
}, []);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment