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]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php