PHP Multiple Try Catch

PHP handle multiple exception at the same time. Use multiple try catch at the same line not nested try catch.

try {
    // run your code here
}
catch (Exception $e) {
    echo $e->getMessage();
}
catch (InvalidArgumentException $e) {
    echo $e->getMessage();
}

1 thought on “PHP Multiple Try Catch

Leave a Reply

Your email address will not be published.