Non-capturing exception catches in PHP 8

1 · Amit Merchant · June 10, 2020, 12:45 p.m.
The usual way of handling the exception is by requiring the catch block to catch the exception (thrown from the try block) to a variable like so. public function bar() { try { throw new Exception('foo!'); } catch (Exception $e) { return $e->getMessage(); } } Here, the exception is being catched in the catch block to a variable $e. This variable now holds any information regarding the exception such as exception message, code, trace, and so on. This is useful in logg...