laravel collection flatmap

Solutions on MaxInterview for laravel collection flatmap by the best coders in the world

showing results for - "laravel collection flatmap"
Lou
29 Feb 2020
1$collection = collect([
2    ['name' => 'Sally'],
3    ['school' => 'Arkansas'],
4    ['age' => 28]
5]);
6
7$flattened = $collection->flatMap(function ($values) {
8    return array_map('strtoupper', $values);
9});
10
11$flattened->all();
12
13// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];