Catch Is Optional

<?php

try {
    $x = initSomething();
    doSomething();        // may throw an exception
}

// no catch: exception keep their way

// finally is always executed
// with or without exception being caught
finally{
    $x->shutdown();
}

?>

In a Try Catch Finally command, only the try part is compulsory. It is possible to create a try command without any catch clause: that way, exceptions are indeed not caught. The finally clause is also optional, but when it is provided, it is always executed, even if exceptions are not caught.

See Also

PHP Features

Last updated: 14 July 2026