← All built-ins / array_walk_recursive()
array_walk_recursive()
array_walk_recursive(...$args): bool
Parameters
| Name | Type | Description |
|---|---|---|
| $a | array | (possibly nested) array |
| $fn | closure | fn(&$value, $key) |
Return value
true; visits leaves of nested arrays only.
Example
$a = [1, [2, 3]]; array_walk_recursive($a, fn(&$v, $k) => $v = $v + 10); echo $a[0], " ", $a[1][0];
11 12