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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners