Re: What is the prevailing sentiment about extract() and compact() ?

From: Date: Wed, 29 Nov 2023 08:36:07 +0000
Subject: Re: What is the prevailing sentiment about extract() and compact() ?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-121853@lists.php.net to get a copy of this message
> > try { > // do stuff > } catch(Throwable $exception) { > $this->logger->error("failed to do stuff", compact('exception')); > throw $exception; > } > I wonder why not just create an array with the key... ```php try { // do stuff } catch(Throwable $exception) { $this->logger->error("failed to do stuff", ['exception' => $exception])); throw $exception; } ``` It's a few more characters of course, but I would pick the readability and simplicity over the potential typos (which the IDE should point out) and a few key presses it saves.I

« previous php.internals (#121853) next »