September 2017
Intermediate to advanced
244 pages
6h 44m
English
This one is an interesting feature in PHP7.1. It was previously possible but was performed in multiple steps. Now, instead of just catching one exception at a time and handling that, there is a multi-catch exception handling facility available. The syntax can be seen here:
<?phptry { // some code} catch (FirstException | SecondException $e) { // handle first and second exceptions}
As you can see here, there is a pipe sign separating these two exceptions. So, this pipe sign | separates multiple exceptions. Here there are just two exceptions in the example, but there can be more than that.
Read now
Unlock full access