note 121480 deleted from language.control-structures by crell

From: Date: Mon, 04 Apr 2022 16:52:54 +0000
Subject: note 121480 deleted from language.control-structures by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218108@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- This is list is missing a link for: try ... catch ... finally blocks. You will find this critical language construct hidden away in the "Exceptions" chapter. And, even though being very verbose and admittedly having useful code examples, that Exceptions chapter actually never formally defines the syntax of the catch block. Per example, if we don't care about accessing the Exception object, one might attempt: try { ... } catch { ... } ... or even: try { ... } catch() { ... } ... Apparently the only acceptable syntax is: try { ... } catch( \Exception | OptionalMyExceptions-1 | ... $exception_instance ) { ... } /* optional additional catch blocks */ catch( ... ) { ... } ... /* optional finally block */ finally { ... }

« previous php.notes (#218108) next »