Source: sebastiandedeyne.com

PHP wishlist: The pipe operator
https://sebastiandedeyne.com/php-wishlist-pipe-operator/ https://sebastiandedeyne.com/tags/php/ https://sebastiandedeyne.com/tags/php-wishlist/https://sebastiandedeyne.com/php-wishlist-pipe-operator/Is it weird to have a favorite operator? Well, the pipe operator |> is mine.

) ->take(5) ->toArray(); With the pipe operator, User:all() could return an array and work with a set of array functions.

{ return $this ->filter(fn (Paper $paper) => $paper->price >= $min && $paper->price map(fn (Paper $paper) => $paper->color) ->uniq(); }

{ return array_filter( $paper, fn (Paper $paper) => $paper->size === $size, ); class PenCollection extends Collection
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners