Category: PHP, PHP

Scout APM helps PHP developers pinpoint N+1 queries, memory leaks & more so you can troubleshoot fast & get back to coding faster. There are a few well known open source maintainers within the PHP community against the use of named arguments, citing maintenance overhead and backwards compatibility problems as reasons not wanting to use them.

The second way named arguments can be used, is in combination with variadic functions, essentially becoming a — in my opinion cleaner — shorthand for passing arrays of data: This is possible thanks to named arguments playing well together with variadic functions: Passing a named argument list into this variadic create function will result in an array like this: Rewriting the above example without named arguments but arrays instead, would look like this: I know which one of these two approaches I prefer.

We really need to be more thoughtful about claiming that we cannot support named arguments in our open source packages because of backwards compatibility issues.

If you want to stay up to date about what's happening on this blog, you can follow me on Twitter or subscribe to my newsletter: EmailSubscribe
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