How can I get around the lack of a finally block in PHP?

前端 未结 7 2168
不思量自难忘°
不思量自难忘° 2020-12-08 18:26

PHP prior to version 5.5 has no finally block - i.e., whereas in most sensible languages, you can do:

try {
   //do something
} catch(Exception ex) {
   //ha         


        
相关标签:
7条回答
  • 2020-12-08 19:07

    If anyone is still keeping track of this question, you might be interested in checking out the (brand new) RFC for a finally language feature in the PHP wiki. The author already seems to have working patches, and I'm sure the proposal would benefit from other developers' feedback.

    0 讨论(0)
提交回复
热议问题