-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
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
Array keys in callable for 'reduce' function #27
Comments
Having |
function reduce(callable $function, $iterable, $startValue = null) {
_assertIterable($iterable, 'Second argument');
$acc = $startValue;
foreach ($iterable as $key => $value) {
$acc = $function($acc, $value, $key);
}
return $acc;
} |
Wasn't fully awake yet, problem I raised doesn't exist. @alxsad You could make a pull request adding the key parameter + tests. |
#28 is merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think will be better if developers will be able to get a key.
Example:
Or I can do it otherwise?
The text was updated successfully, but these errors were encountered: