Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions source/_posts/2025-07-11-php-85-adds-pipe-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ $arr = [
];

$result = $arr
|> fn($x) => array_column($x, 'tags') // Gets an array of arrays
|> fn($x) => array_merge(...$x) // Flatten into one big array
|> (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.
;
Expand Down Expand Up @@ -90,12 +90,12 @@ $string = 'something GoesHERE';
$newString = match ($format) {
'snake_case' => $string
|> splitString(...)
|> fn($x) => implode('_', $x)
|> (fn($x) => implode('_', $x))
|> strtolower(...),
'lowerCamel' => $string
|> splitString(...),
|> fn($x) => array_map(ucfirst(...), $x)
|> fn($x) => implode('', $x)
|> (fn($x) => array_map(ucfirst(...), $x))
|> (fn($x) => implode('', $x))
|> lcfirst(...),
// Other case options here.
};
Expand Down