NYCPHP Meetup

NYPHP.org

[nycphp-talk] "Finally" missing in PHP...

Justin Dearing zippy1981 at gmail.com
Tue Aug 5 10:56:16 EDT 2008


On Tue, Aug 5, 2008 at 10:50 AM, David Mintz <david at davidmintz.org> wrote:
>
>
> On Tue, Aug 5, 2008 at 10:37 AM, <paul at devonianfarm.com> wrote:
>>
>> I've been using exceptions more in PHP.  I've found some fun things
>> lately,  like how to reroute errors,  warnings and notices as exceptions.
>> It bugs me a lot that PHP doesn't support 'finally',  however,  because I've
>> found that,  overall,  it's better than catch...
>>
>> http://gen5.info/q/2008/07/31/stop-catching-exceptions/
>
>
> "Better" than catch? Do explain. Because AFAIK once it's thrown, somebody
> has to handle it somewhere along the stack, and _finally_ won't do it unless
> you die.

Finally is not better than catch, its different. You can use both on a
try in most languages that support it.

But where do you find yourself using it? For cleaning up database
connection strings?

Also, finally is always fired after a try block exits, unless there is
a catch block in which case its after successful completion of the try
block or exiting of the catch block.



More information about the talk mailing list