Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77393 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48073 invoked from network); 20 Sep 2014 19:48:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2014 19:48:19 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.192.178 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.192.178 mail-pd0-f178.google.com Received: from [209.85.192.178] ([209.85.192.178:49080] helo=mail-pd0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/19-24334-20ADD145 for ; Sat, 20 Sep 2014 15:48:19 -0400 Received: by mail-pd0-f178.google.com with SMTP id ft15so1966956pdb.37 for ; Sat, 20 Sep 2014 12:48:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=cFtadm+xKZfuJLd5TSctEgqW9DgeBCqElEWRnlq3eKI=; b=ElZJG+2AmwIpu7RNzUH1STwsmALJXvTSK///0A0FRfgGuHPs0NFALbbPNn+jG8sOhj 2fRKxpiyt80nXEooh08eiblElDrOJd41FBcYlS1N5qNAPNi8MgmpTEhQM6bVixxGvcTG eq/qUFtplmK6FwxAo7Ko2gQqxwY8Cg64oJWe7QOjgiId+OrCBaCSeFv5Ot4d0Km7QXw/ 5HOyCg7dcvVNks+I9r8ZhFLixuVXUxTT2mjbzMy5qQG13nV+8xgrNbMnpNVAzyWU8UPU xVil57pYdhlzNYRZ1o8z6xGZfiq42thuMCtkGxP5hrtjJ4PiNSpQVCibaiD350SJrSaA +m8A== X-Gm-Message-State: ALoCoQlJbVx0PS0MnVi3etNVHoRurqdYmK1z6o/hJ/VecbwMjufsvvEF3/YeSRJcE34cAqLjYAbH X-Received: by 10.70.135.162 with SMTP id pt2mr13419059pdb.2.1411242496484; Sat, 20 Sep 2014 12:48:16 -0700 (PDT) Received: from [10.49.247.31] (mobile-166-171-248-027.mycingular.net. [166.171.248.27]) by mx.google.com with ESMTPSA id gj10sm719401pbd.50.2014.09.20.12.47.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 20 Sep 2014 12:48:15 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (11D201) In-Reply-To: Date: Sat, 20 Sep 2014 12:47:43 -0700 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <1A5B2D07-FEC6-410E-85C9-3FBE2F105104@golemon.com> References: To: Leigh Subject: Re: [PHP-DEV] [RFC] Loop... or... From: php@golemon.com (Sara Golemon) > On Sep 19, 2014, at 14:56, Leigh wrote: > https://wiki.php.net/rfc/loop_or >=20 I like the general idea, but rather than explicitly focusing on the 'or' key= word, how about just giving all loop constructs (do/while/for/foreach) a ret= urn value? I'd suggest an integer return value indicating the number of tim= es the loop executed. This accomodates your use case since foreach(...) {} or { defaultblock } sti= ll works, while also allowing for others: e.g.: $ranTwice =3D foreach(...) {} =3D=3D 2; It does introduce a temp var, but OpCache+ can trivially optimize that out w= hen it isn't used. -Sara=