> On Sep 19, 2014, at 14:56, Leigh <lei...@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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to