Php exceptions

From wikinotes
Revision as of 01:15, 9 July 2020 by Will (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation

official docs https://www.php.net/manual/en/class.exception.php

Notes

throw new Exception("Division by zero");
try {
  // code that can throw exceptions
} catch(Exception $e) {
  // code that runs when an exception is caught
} finally {
  // code that always runs regardless of whether an exception was caught
}