https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/ Теперь хочется 8.5 побыстрее. `$arr = [ new Widget(tags: ['a', 'b', 'c']), new Widget(tags: ['c', 'd', 'e']), new Widget(tags: ['x', 'y', 'a']), ];
$result = $arr |> fn($x) => array_column($x, 'tags') // Gets an array of arrays |> fn($x) => array_merge(...$x) // Flatten into one big array |> array_unique(...) // Remove duplicates |> array_values(...) // Reindex the array. ;
// $result is ['a', 'b', 'c', 'd', 'e', 'x', 'y'] Пайпить функции вместо их вкладывания друг в друга - это замечательно! `array_values(array_unique(array_merge(...array_column($arr, 'tags'))));``