Skip to content

Commit 288bab4

Browse files
saundefinedpronskiy
authored andcommitted
Update Pipe post
Fix #246
1 parent 16a1de3 commit 288bab4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/_posts/2025-07-11-php-85-adds-pipe-operator.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ $arr = [
3232
];
3333

3434
$result = $arr
35-
|> fn($x) => array_column($x, 'tags') // Gets an array of arrays
36-
|> fn($x) => array_merge(...$x) // Flatten into one big array
35+
|> (fn($x) => array_column($x, 'tags')) // Gets an array of arrays
36+
|> (fn($x) => array_merge(...$x)) // Flatten into one big array
3737
|> array_unique(...) // Remove duplicates
3838
|> array_values(...) // Reindex the array.
3939
;
@@ -90,12 +90,12 @@ $string = 'something GoesHERE';
9090
$newString = match ($format) {
9191
'snake_case' => $string
9292
|> splitString(...)
93-
|> fn($x) => implode('_', $x)
93+
|> (fn($x) => implode('_', $x))
9494
|> strtolower(...),
9595
'lowerCamel' => $string
9696
|> splitString(...),
97-
|> fn($x) => array_map(ucfirst(...), $x)
98-
|> fn($x) => implode('', $x)
97+
|> (fn($x) => array_map(ucfirst(...), $x))
98+
|> (fn($x) => implode('', $x))
9999
|> lcfirst(...),
100100
// Other case options here.
101101
};

0 commit comments

Comments
 (0)