This article is mainly about PHP Finally, has a certain reference value, now share to everyone, the need for friends can refer to
Finally is the keyword that was introduced in the php5.5 version. Finally is not the original PHP, C #, Javascript, Java. And so on other languages, PHP's finally is similar to other languages.
Regarding the try catch finally syntax, we primarily care about its execution order:
try {//execute code, where there may be an exception. Once an exception is found, jump to catch execution immediately. Otherwise, the contents of the catch will not be executed}
catch {//unless the execute code inside the try has an exception, the code here does not execute}
finally {//No matter what happens, including a return in the try catch, it is understood that if a try or catch is executed, it will be executed finally}
It is important to note that if finally contains return, it overwrites the return in the try or catch.
Reference:
Https://www.cnblogs.com/aspirant/p/6789040.html?utm_source=itdadao&utm_medium=referral
Https://www.cnblogs.com/muzidiandian/p/7026557.html