3

Is there a way to implement a finally block for PHP versions below 5.5?

user4157124
  • 2,809
  • 13
  • 27
  • 42
cryptonkid
  • 924
  • 1
  • 17
  • 25

1 Answers1

2

You can do like this,

try {
   # ...
} catch (Exception $e) {
   # ... but don't re- throw $e!
}

# ... finally ...

if (isset ($e)) {
    throw $e;
}

But, I should recommend to upgrade PHP. It shouldn't be that hassle.

hakre
  • 193,403
  • 52
  • 435
  • 836
Rahul
  • 18,271
  • 7
  • 41
  • 60