How to go to catch instead of try in PHP try catch

avatar
Published: Feb 01, 2023

You quickly give an exception and throw in a try-catch. So they try not to execute.

try {
    print "enter to try";
    throw new Exception();
} catch (Exception $e) {
    print "something went wrong, enter in catch";
} finally {
    print "oh! in final";
}
PHP