News for hackers. Stuff that matters.
Re:PHP doesn't need 'finally' by bnoordhuis on Friday December 10, 2010 @08:43AM (#1991580)
Without the finally block, do_something_finally() will not be called if:

1. the try block returns

2. the catch block doesn't handle /all/ types of exceptions

The point of finally is that it's always, always, always executed.

Re:PHP doesn't need 'finally' by BrandonM on Friday December 10, 2010 @10:56AM (#1992000)
> The point of finally is that it's always, always, always executed.

Except when it's not. If you design a large system with the assumption that finally blocks always execute, you could end up with some data integrity issues when you get a power outage, an exception in your finally clause, a hung machine, or any other number of errors that a finally clause does nothing to address.

The finally clause is very useful, but to say that it will always (x3!) execute is somewhat perilous.