Catching multiple exception types in one catch block
Update: As of PHP 7.1, this is available. The syntax is: try { // Some code… } catch(AError | BError $e) { // Handle exceptions } catch(Exception $e) { // Handle the general case } Docs: https://www.php.net/manual/en/language.exceptions.php#example-294 RFC: https://wiki.php.net/rfc/multiple-catch Commit: https://github.com/php/php-src/commit/0aed2cc2a440e7be17552cc669d71fdd24d1204a For PHP before 7.1: Despite what these other answers say, you can catch AError … Read more