Skip to content

Commit d703c6b

Browse files
authored
Update README.md
1 parent 279096a commit d703c6b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,19 @@ Flatten an associative array using a custom separator.
255255
##### `static dot(array $array) : array`
256256

257257
Flatten an associative array using a dot (.) separator.
258+
259+
##### `static each(array $array, callable $callable) : array`
260+
261+
Recursively assign the callable's return value to each array item. Array keys are preserved.
262+
263+
```php
264+
<?php
265+
use Noname\Common\Arr;
266+
267+
$values = [1, 2, 3, 4, 5];
268+
269+
// @return [2, 4, 6, 8, 10]
270+
$values_doubled = Arr::each($values, function ($value) {
271+
return $value * 2;
272+
});
273+
```

0 commit comments

Comments
 (0)