3 ms·
Why didn't you format the pipes, too? $result = $arr |> fn($x) => array_column($x, 'tags') |> fn($x) => array_merge(...$x) |> array_unique(...)
by troupo 1y ago
Why didn't you format the pipes, too?
$result = $arr
|> fn($x) => array_column($x, 'tags')
|> fn($x) => array_merge(...$x)
|> array_unique(...)
|> array_values(...)
vs
array_values(
array_unique(
array_merge(
...array_column($arr, 'tags')
)
)
);
With pipes you have linear sequence of data transformations. With nested function calls you have to start with innermost function and proceed all the way top the outermost layer.
- qwertox 1y agoBecause they were already formatted that way to begin with.