Re: [RFC] Loop... or...

From: Date: Sat, 20 Sep 2014 19:47:43 +0000
Subject: Re: [RFC] Loop... or...
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-77393@lists.php.net to get a copy of this message
> On Sep 19, 2014, at 14:56, Leigh <leight@gmail.com> wrote: > https://wiki.php.net/rfc/loop_or > I like the general idea, but rather than explicitly focusing on the 'or' keyword, how about just giving all loop constructs (do/while/for/foreach) a return value? I'd suggest an integer return value indicating the number of times the loop executed. This accomodates your use case since foreach(...) {} or { defaultblock } still works, while also allowing for others: e.g.: $ranTwice = foreach(...) {} == 2; It does introduce a temp var, but OpCache+ can trivially optimize that out when it isn't used. -Sara

« previous php.internals (#77393) next »