Accumulate

in ita •  25 days ago 

declare(strict_types=1);

function accumulate(array $input, callable $accumulator): array{
$result = [];
for($i=0; $i<count($input); $i++) {
$result[$i] = $accumulator($input[$i]);
}
return $result;
}

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!