NYCPHP Meetup

NYPHP.org

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

Guilherme Blanco guilhermeblanco at gmail.com
Tue Aug 5 11:09:11 EDT 2008


You can do an ugly hack.... supported:


try {
  // ...
} catch (Exception $e) {
  // ...
}

// finally... you can use $e here, you know?!!?!? =)



Cheers,

On Tue, Aug 5, 2008 at 11:56 AM, Justin Dearing <zippy1981 at gmail.com> wrote:
> 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.
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>



-- 
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco at hotmail.com
URL: http://blog.bisna.com
Rio de Janeiro - RJ/Brazil



More information about the talk mailing list