Re: Unwrap reference after foreach

From: Date: Mon, 16 Aug 2021 13:41:49 +0000
Subject: Re: Unwrap reference after foreach
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-115758@lists.php.net to get a copy of this message
> > This seems like a good opportunity to go one step further and have loops create a new scope, > which would automagically handle the unwrapping with out worrying about the edge cases. Obviously, > this would be a bigger BC break, but one worth considering. > Sounds reasonable, but this is too much a BC break for my taste. PHP doesn’t have a lot of scopes, and at a quick glance, this would increase them by 33%. I /know/ I wrote code using the last iterated index/key of a loop. That said, I also /know/ I wrote code using the value-by-reference after the loop, so I’m neither keen on voting +1 on the actual proposal. Granted though, it’d be an easy fix if there’s already a condition in the loop breaking its continuation. Regards, Mike

Attachment: [application/pgp-signature] Message signed with OpenPGP signature.asc
« previous php.internals (#115758) next »