Merge pull request #3383 from divayprakash/fix-php

[php/en] Fix exception handling example
This commit is contained in:
Divay Prakash 2018-11-02 04:29:39 +05:30 committed by GitHub
commit 19ba7e09b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -837,11 +837,14 @@ try {
// Handle exception
}
// When using try catch blocks in a namespaced environment use the following
// When using try catch blocks in a namespaced environment it is important to
// escape to the global namespace, because Exceptions are classes, and the
// Exception class exists in the global namespace. This can be done using a
// leading backslash to catch the Exception.
try {
// Do something
} catch (Exception $e) {
} catch (\Exception $e) {
// Handle exception
}