Skip to content

Multiple Catch Blocks

Multiple catch blocks allow handling different exceptions separately.

try {
throw new RuntimeException("Runtime error");
} catch (InvalidArgumentException $e) {
echo "Invalid argument";
} catch (RuntimeException $e) {
echo "Runtime problem";
}