Explain how PHP handles errors vs. exceptions since PHP 7/8.

Last updated 15 June 2026

  • Since PHP 7 most fatal errors are thrown objects. Both Error (engine faults like TypeError, DivisionByZeroError) and Exception (application conditions) implement Throwable.

  • Use catch (Throwable $e) to handle both together. Userland classes can't implement Throwable directly and must extend one of the two.

  • Warnings and notices (E_WARNING, E_NOTICE) are not throwables. Convert them via set_error_handler() throwing an ErrorException.

  • https://docs.airbrake.io/blog/php-exception-handling/the-php-exception-class-hierarchy/
  • https://utkrusht.ai/blog/php-interview-questions
All PHP interview questions