When looking at recent changes in the Laravel framework, I saw some PHP syntax that I didn't see before. Because I've been working with PHP for over 20 years and have a firm grasp of the language, I was surprised to see new syntax for the first time.

You might have seen the... operator (aka the spread or splat operator) in various other contexts.

collect(['a' 'b', 'c']) ->map(function($letter) { return strtoupper($letter); }); Using the first-class callable syntax, you can rewrite that code like this.

If you want to know more about this syntax, check out https://php.watch/versions/8.1/first-class-callable-syntax, which also lists the limitations and edge cases.
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