# [VOTE] [RFC] Loop + or control structure

- Thread: https://externals.io/message/77766
- Original archive: https://news-web.php.net/php.internals/77766
- Started by Leigh on 2014-10-03T20:33:20+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #77766 — Leigh — 2014-10-03T20:33:20+00:00

URL: https://externals.io/message/77766#77766

Hi all,

Opening the vote on loop + or control structures.

https://wiki.php.net/rfc/loop_or

Voting will close in 1 week and requires a 2/3 in favour to pass.

Remember at this stage the implementation is flexible.

Cheers,

Leigh.

---

## #77835 — Pascal Martin — 2014-10-09T21:20:50+00:00

URL: https://externals.io/message/77766#77835 · In reply to: #77766

> Opening the vote on loop + or control structures.
>
> https://wiki.php.net/rfc/loop_or
>
> Voting will close in 1 week and requires a 2/3 in favour to pass.
>
> Remember at this stage the implementation is flexible.
>

Hi,

After talking with other members of AFUP, it seems most of us like the 
idea of having some way of executing code if a loop is never executed.

The "or" keyword feels a bit odd to those who are used to the "else" of 
Twig (or other languages) -- but it's not really that much of a problem 
either: after a while, we'll get used to using "or" (or some other keyword).

So, we would be on the +1 side of things on this.


Still, Sara's idea of giving all loop constructs a return value 
indicating the number of times the loop executed feels great -- and this 
would probably be more flexible than loop...or

I'm guessing this is why you voted "no" on your own RFC?

-- 
Pascal MARTIN, AFUP - French UG
http://php-internals.afup.org/

---

## #77836 — Leigh — 2014-10-09T21:49:57+00:00

URL: https://externals.io/message/77766#77836 · In reply to: #77835

>
> I'm guessing this is why you voted "no" on your own RFC?
>

Getting this feature working was the result of several compromises,
and I didn't like the idea of feeling like "I wish this was different,
oh wait... it's my fault..." every time I used it.

It really did boil down to syntactic sugar. There was a small
performance gain on large loops compared to using a tracking variable,
but it wasn't really enough to overcome my negative feelings towards
it.

The groundwork and proof of concept patch is there. If someone else
knows how to make it sexy, they're free to pick it up and run with it
:)
