Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58235 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80505 invoked from network); 28 Feb 2012 14:23:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2012 14:23:15 -0000 Authentication-Results: pb1.pair.com header.from=kiall@managedit.ie; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kiall@managedit.ie; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain managedit.ie designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: kiall@managedit.ie X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:44169] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/00-14730-153EC4F4 for ; Tue, 28 Feb 2012 09:23:14 -0500 Received: by iaeh11 with SMTP id h11so2895809iae.29 for ; Tue, 28 Feb 2012 06:23:10 -0800 (PST) Received-SPF: pass (google.com: domain of kiall@managedit.ie designates 10.50.85.202 as permitted sender) client-ip=10.50.85.202; Authentication-Results: mr.google.com; spf=pass (google.com: domain of kiall@managedit.ie designates 10.50.85.202 as permitted sender) smtp.mail=kiall@managedit.ie; dkim=pass header.i=kiall@managedit.ie Received: from mr.google.com ([10.50.85.202]) by 10.50.85.202 with SMTP id j10mr2637232igz.58.1330438990381 (num_hops = 1); Tue, 28 Feb 2012 06:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=managedit.ie; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=VUMiWA9zdrAxy6+5wXv1vmhCewjaQqVcK+EJvQXaR5E=; b=J57WWWTjNJzSJGJZtdUYc9F6Vp2EV4cddfwSP1b1RX24rt5ZY8XUndK64iYi7pP06y YHoYBwI6X687AxXXueDOe+i78VxB0B4sUdZOYNwsDqc+q8sj/aW7V/7O/nwkL0z+x1bD KI9Azav+vuFe8pDGWQ7tn3lmCb89ob+vL/lUI= Received: by 10.50.85.202 with SMTP id j10mr2224057igz.58.1330438990286; Tue, 28 Feb 2012 06:23:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.200.137 with HTTP; Tue, 28 Feb 2012 06:22:50 -0800 (PST) In-Reply-To: <01a901ccf622$0645f230$12d1d690$@alliantinternet.com> References: <01a901ccf622$0645f230$12d1d690$@alliantinternet.com> Date: Tue, 28 Feb 2012 14:22:50 +0000 Message-ID: To: Dmitri Snytkine Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8f3ba877694dc304ba06f7b2 X-Gm-Message-State: ALoCoQnYWvykx9qQPqFWc8/g4Xv2Nwgb8LNc/eyFQvAKYmu8Ju/zu+/nI6HYAuzAMUfo5QZKKYOq Subject: Re: [PHP-DEV] Possibility to add finally to try/catch? From: kiall@managedit.ie (Kiall Mac Innes) --e89a8f3ba877694dc304ba06f7b2 Content-Type: text/plain; charset=ISO-8859-1 +1000 This is a feature that I've always wanted in PHP, My main reason being to reduce code duplication. eg try { $fh = fopen($filename); // Do some work on the file + encounter an error. throw new Exception(); } catch (Exception $e) { // Log an error or something } finally { fclose($fh); } Thanks, Kiall On Tue, Feb 28, 2012 at 2:05 PM, Dmitri Snytkine < dsnytkine@ultralogistics.com> wrote: > > This is another feature that we know we can live without > but those familiar with languages that have 'finally' like Java or Python > know that > it is very neat feature to have in some situations. > > Basically the code inside 'finally' is guaranteed to run even if there is a > 'return' inside try or catch blocks > in which case the value to be returned is remembered tempraraly, the code > inside finally block executes and then remembered value is returned. > > > Dmitri Snytkine > Web Developer > Ultra Logistics, Inc. > Phone: (888) 220-4640 x 2097 > Fax: (888) 795-6642 > E-Mail: dsnytkine@ultralogistics.com > Web: www.ultralogistics.com > > "A Top 100 Logistics I.T. Provider in 2011" > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --e89a8f3ba877694dc304ba06f7b2--