This is a searchable reference for PHP’s two error systems — the procedural error level constants (E_ERROR, E_WARNING, E_NOTICE, E_DEPRECATED and friends) and the object-oriented Throwable hierarchy of Error and Exception classes. It pairs each error constant with its bitmask value and each exception class with its parent and typical cause.
PHP’s two parallel error systems
PHP grew its error system in two separate eras, and both are still active today:
Procedural error levels predate PHP 5. They are integer bitmasks set via error_reporting() and handled by a global handler registered with set_error_handler(). You cannot catch them with try/catch.
Object exceptions arrived with PHP 5 and were significantly expanded in PHP 7. They are objects you throw and catch in the normal way. Since PHP 7, the Throwable interface is the common ancestor of both Error (engine errors, type failures, division by zero) and Exception (user-land application errors). Code written before PHP 7 that catches \Exception will silently miss the \Error family — a common source of uncaught fatal errors after an upgrade.
How it works
PHP error levels are bit flags: every constant is a distinct power of two (E_ERROR = 1, E_WARNING = 2, E_NOTICE = 8, and so on) and E_ALL is the combined mask. You configure which levels are reported by composing them — | to include a level and & ~ to exclude one. For example E_ALL & ~E_DEPRECATED reports everything except deprecation notices.
The full bitmask table includes these key values:
| Constant | Value | Severity |
|---|---|---|
| E_ERROR | 1 | Fatal — script stops |
| E_WARNING | 2 | Non-fatal, logged |
| E_PARSE | 4 | Parse error |
| E_NOTICE | 8 | Minor issue |
| E_DEPRECATED | 8192 | Feature will be removed |
| E_ALL | 32767 | Every level |
Code example
A reporting mask plus catching the modern Throwable tree:
error_reporting(E_ALL & ~E_NOTICE); // everything except notices
try {
$r = intdiv(10, 0); // throws DivisionByZeroError (an Error)
} catch (\Throwable $e) { // catches Error AND Exception
echo get_class($e) . ": " . $e->getMessage();
}
DivisionByZeroError extends ArithmeticError, which extends Error, which implements Throwable — so a plain catch (\Exception $e) would not catch it, but catch (\Throwable $e) does.
The Throwable hierarchy at a glance
Throwable
├── Error
│ ├── TypeError
│ ├── ParseError
│ ├── ArithmeticError
│ │ └── DivisionByZeroError
│ └── AssertionError
└── Exception
├── RuntimeException
│ ├── OutOfBoundsException
│ └── UnexpectedValueException
└── LogicException
├── InvalidArgumentException
└── BadMethodCallException
Common mistakes
- Catching only
\Exceptionafter a PHP 7 upgrade: the\Errorfamily slips through uncaught. - Using
E_ALLin production without suppressingE_NOTICEandE_STRICT: trivial notices fill logs and hide real errors. - Confusing
E_RECOVERABLE_ERROR(can be caught by a custom error handler) with a true fatalE_ERROR(cannot).
Everything runs in your browser; nothing is uploaded.