On Fri, Jan 5, 2024, at 5:16 PM, Mönôme Epson wrote: > ---------- Forwarded message ---------
> I try to follow the procedure of: https://wiki.php.net/rfc/howto > > It seems to me that list() is not clearly specified. > I wanted to know your opinions on this. > > > For example : > $key = "a"; > $value = 1; > $array = [$key => $value]; > > [$key => $value] = $array; > > We all agree that now $key = 'a' and $value = 1 > > And I wonder why > What happens in this case : > > [$key => $value] = ['b'=>2]; > > $key = 'b' and $value = 2 or all is null ? Please don't top-post. As for what that does: https://3v4l.org/5ubJU That's because the right-side can have many keys with their own values, but the left side... doesn't really do that. The left side only assigns values, not keys. I'm not sure how it would be useful to decompose like you're describing, since it would only really make sense with a single array item on the left, which is not a common or useful case. What you can do, as Rowan noted, is this: https://3v4l.org/cEmcC That pulls items out of the array by key, into named variables. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php