On Wed, Mar 24, 2021 at 2:26 PM Mark Randall <marand...@php.net> wrote:
> To give my own example, earlier this week I wrote the following: > > $x = function () use ($to, $library, $thread, $author, $title, > $library_name, $top_post) { ... } > > That was just to get those variables inside a callback that could be > invoked inside a throw-aware buffering helper. > Hi Mark, Have you considered using an array or DTO to pass the data? You could also do this (although I'm not advocating it): ``` $vars = get_defined_vars(); $x = function() use ($vars) { extract($vars); /* ... */ }; ``` Thanks, Peter