Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29157 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11568 invoked by uid 1010); 3 May 2007 14:55:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11553 invoked from network); 3 May 2007 14:55:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2007 14:55:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=robinv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=robinv@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.174 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: robinv@gmail.com X-Host-Fingerprint: 66.249.92.174 ug-out-1314.google.com Linux 2.4/2.6 Received: from [66.249.92.174] ([66.249.92.174:63104] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/C2-27633-2F7F9364 for ; Thu, 03 May 2007 10:55:47 -0400 Received: by ug-out-1314.google.com with SMTP id o4so385320uge for ; Thu, 03 May 2007 07:55:44 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QqgCJezoO3U1Bwn6lgVvJwFJQHfUrgh7EQLcfrGvvuglEnpnQnzBtU5ojSpzBPpBYtBw9JP0Z7KZzbl0wtfhWsTLkyyckCh5jyrRhm35qb0xdWpFFCYXwTl/PHkDygA8C45er4vCJGEZR9zY7DAX0KlYc5RMc3W5PHioCIBUCy0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gsKS+xDdULHefqxxKo0S6jKEDMSak0Znu9ESN1rspzMJ5J46Bqu8WNMcgMPRTLARWfB7BRU77P+CcrRPy4FN8k7uGpbYvszplIg4rEE2YEMbHLMrCV7BNorfAh2y6XIwTySMw4Vr8yHujmRA4zCWqe/xkKu239jVqyjWUf0o34I= Received: by 10.78.190.10 with SMTP id n10mr359491huf.1178204143995; Thu, 03 May 2007 07:55:43 -0700 (PDT) Received: by 10.78.167.15 with HTTP; Thu, 3 May 2007 07:55:43 -0700 (PDT) Message-ID: <5cb2dafd0705030755g16cfae12xd5c0c716742964fb@mail.gmail.com> Date: Thu, 3 May 2007 15:55:43 +0100 To: internals@lists.php.net In-Reply-To: <82F935820ADAF34089CFF7E6C49655B4013F3D48@GTSPOST1.gts.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <82F935820ADAF34089CFF7E6C49655B4013F3D48@GTSPOST1.gts.dk> Subject: Re: [PHP-DEV] While-else From: robinv@gmail.com ("Robin Vickery") On 28/04/07, Pelle Ravn Rosfeldt wrote: > Hi there. > > Is it possible to make a "while" with a "else"-statement in PHP6? > I know that it's not the first time this subject is up, but my research > shows that a lot of people miss it. Including me. > > Here's an example of what I mean: > --------------------- > $i = 1; > while ($i <= 10) { > echo $i++; > } else { > echo "The while couldn't be executed!"; > } > ?> > --------------------- > > Python & Perl already have this function. So why not PHP? The 'but everyone else is doing it' argument is particularly weak when it's not actually accurate. $ man perlsyn > The following compound statements may be used to control flow: > [...] > LABEL while (EXPR) BLOCK > LABEL while (EXPR) BLOCK continue BLOCK $ perl -le '$i = 99; while ($i < 10) { $i++; } else { print "Oh..."; }' syntax error at -e line 1, near "} else" I can't see any point in it myself. It doesn't read naturally and it doesn't add anything that you don't get by preceding your while with a simple if statement. -robin