Closed thekid closed 6 years ago
Will catch but not assign any variable:
try { … } catch (IllegalArgumentException) { // Handle exception }
Will catch all exceptions - a shorthand for catch (\Throwable $e):
catch (\Throwable $e)
try { … } catch ($e) { // Handle exception }
Will catch all exceptions and not assign any variable:
try { … } catch { // Handle }
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch https://wiki.php.net/rfc/anonymous_catch - allows omitting variable if not needed.
Form without variable
Will catch but not assign any variable:
Form without type
Will catch all exceptions - a shorthand for
catch (\Throwable $e)
:Anonymous catch
Will catch all exceptions and not assign any variable:
Related
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch https://wiki.php.net/rfc/anonymous_catch - allows omitting variable if not needed.