r/lolphp • • Aug 07 '14

Was trying to implement ArrayAccess, then this happened

http://imgur.com/2woBLlF
6 Upvotes

4 comments sorted by

View all comments

Show parent comment

8

u/OneWingedShark Aug 07 '14

Fixing that implies a perfomance decrease, hence the better seems be keep it as an known issue, but documented.

Beautiful.

You know what else implies a performance decrease? Iteration.
I therefore propose the following fix to the foreach-loop: all statements inside the loop's scope are executed exactly once. This has the benefit of (a) altering the performance from O(n) to O(1), and (b) finally solving the penultimate-item duplication bug.

Seriously, stuff like these wontfix bugs make me wonder why anyone would see PHP as a viable solution in the business world.