On Sat, Aug 14, 2021 at 6:00 PM Claude Pache wrote:
>
> Le 13 août 2021 à 15:28, Nikita Popov a écrit :
>
> Hi internals,
>
> I'd like to address a common footgun when using foreach by reference:
> https://wiki.php.net/rfc/foreach_unwrap_ref
>
> This addresses the issue described in the big red
>
> 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
> Le 13 août 2021 à 15:28, Nikita Popov a écrit :
>
> Hi internals,
>
> I'd like to address a common footgun when using foreach by reference:
> https://wiki.php.net/rfc/foreach_unwrap_ref
>
> This addresses the issue described in the big red box at
>
well today you can do
foreach($it as &$value){...} unset($value);
- which is pretty close, but it will break with
$value="initial";foreach($it as &$value){...}unset($value); echo $value;
here $value will not be "initial", it will be undefined, however you *CAN*
do
Speaking of, i hope that one day we can support javascript-style let in php
:) like
foreach($it as let &$v){}
but that's a discussion for another thread (and i'm sure it has been
discussed before, i haven't actually checked though)
On Sat, 14 Aug 2021 at 15:23, Hossein Baghayi
wrote:
> On Fri,
On Fri, 13 Aug 2021 at 17:59, Nikita Popov wrote:
> I'd like to address a common footgun when using foreach by reference:
> https://wiki.php.net/rfc/foreach_unwrap_ref
>
Hello,
I had a question regarding this.
Wouldn't it be possible to limit ```$value```'s scope to only foreach's
block then
Original Message
On Aug 13, 2021, 9:28 AM, Nikita Popov < nikita@gmail.com> wrote:
Hi internals,
I'd like to address a common footgun when using foreach by reference:
https://wiki.php.net/rfc/foreach_unwrap_ref
This addresses the issue described in the big red box at
I’m happy with this too. I’m +1 for most things that makes a smoother developer
experience.
//Tobias Nyholm
> On 13 Aug 2021, at 06:44, Hans Henrik Bergan wrote:
>
> +1 from me, and yeah lets not care about that edge case, i hope the edge
> gets removed at some point.. (but that's an issue
On Fri, Aug 13, 2021 at 11:20 AM Claude Pache
wrote:
>
> > Le 13 août 2021 à 15:28, Nikita Popov a écrit :
> >
> > Hi internals,
> >
> > I'd like to address a common footgun when using foreach by reference:
> > https://wiki.php.net/rfc/foreach_unwrap_ref
> >
> > This addresses the issue
> Le 13 août 2021 à 15:28, Nikita Popov a écrit :
>
> Hi internals,
>
> I'd like to address a common footgun when using foreach by reference:
> https://wiki.php.net/rfc/foreach_unwrap_ref
>
> This addresses the issue described in the big red box at
>
+1 from me, and yeah lets not care about that edge case, i hope the edge
gets removed at some point.. (but that's an issue for another thread)
FWIW if attempts at getting it in 8.2 fails, i would welcome another
attempt at this for PHP9
On Fri, 13 Aug 2021 at 15:29, Nikita Popov wrote:
> Hi
Hi internals,
I'd like to address a common footgun when using foreach by reference:
https://wiki.php.net/rfc/foreach_unwrap_ref
This addresses the issue described in the big red box at
https://www.php.net/manual/en/control-structures.foreach.php. While this is
"not a bug" (as our bug tracker can
12 matches
Mail list logo