Re: Making "match" catch exceptions
| From: | Rowan Tommins | Date: | Sat, 27 Mar 2021 14:30:16 +0000 |
| Subject: | Re: Making "match" catch exceptions | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-113810@lists.php.net to get a copy of this message | ||
On 26/03/2021 22:58, Olle Härstedt wrote:
You can't catch the value of $temp in the match-case?
$foo = $bar + match (doSomething()) {
$temp => $temp,
exception SomeException => 0
};
$temp doesn't have an outside value, it was an inline assignment to capture the value of doSomething(); essentially, I wanted this, but without executing doSomething() twice:
$foo = $bar + match (doSomething()) {
default => doSomething(),
exception SomeException => 0
};
Regards,
--
Rowan Tommins
[IMSoP]