Control Structures



Any PHP script is built out of a series of statements. A statement can be an assignment, a function call, a loop, a conditional statement or even a statement that does nothing (an empty statement). Statements usually end with a semicolon. In addition, statements can be grouped into a statement-group by encapsulating a group of statements with curly braces. A statement-group is a statement by itself as well. The various statement types are described in this chapter.


This is list is missing a link for:
try ... catch ... finally

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 { ... }
2017-08-05 00:52:05

    Поддержать сайт на родительском проекте КГБ