Skip to content

Exception Class

The Exception class is the base class for all user-defined exceptions.

It provides useful methods for debugging and handling errors.

try {
throw new Exception("Custom exception");
} catch (Exception $e) {
echo $e->getMessage();
}