Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122129 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30079 invoked from network); 5 Jan 2024 23:48:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jan 2024 23:48:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1704498529; bh=0K2cs9qkBeKnNzoom5hGWmHu8g7uY6ZtgSEz2i00U6M=; h=In-Reply-To:References:Date:From:To:Subject:From; b=OO2oGyKyN8nwPVYaJ0ocSpnsaX1cZ/GeHdmK4lqmfimehySjjx7LDpcbVnee6UuSo OWVcOA61JQFYyvLpbwIyelWLb9Jcwz1QcGlDzOGLGMiSgRUFoLFu54ehAbwIYNMC7K cDCGTunnVakCsl6r6rNTMqg3iFgx6mxpgewbiojVkaoSD564gqmf69LMqUlFK7OngP BMNPRwQ5Tcxs/Nr9LIyz3Kz3iSJuIAaAPMADuU8Jsadvojm0JT1KVz4g+J1X5bT5Rs 4Uv+kr1dt8EnuE4XvEQ+VoNQn3jDMOxZ9p264JB60cHwxivSWXIl8NWXdUloyab5g0 umpoZeVuzOhQQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C318D180038 for ; Fri, 5 Jan 2024 15:48:48 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 5 Jan 2024 15:48:48 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8B2E75C02A4 for ; Fri, 5 Jan 2024 18:48:15 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 05 Jan 2024 18:48:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1704498495; x=1704584895; bh=cDVUuadezugTmzmJuJs2t 011iWS2CEM/ZvTkGtF9NmA=; b=nI6J4O3Bltx71ON4yWD2of8DSTvxNPhER2G+p GO7GE/i8QnpmWQh6W6GH7cnw7WBZKWVR6VKvKYucxfenMib1HGibBA4ZxRMT/dEL OvA4ueq0uD9a80BjU2+4BS3aBmGUIeticA3JUL0lULIhkyp68DUHBdQV1MEkf8Qs /Ed877+/UtfcU59lAX3MjXysGj4j2Kcz8FPRp/FAFEhFJnrqAp+gnttM5bwJfNAR KEWhFn5GrMzVabPYlrDxa/0PM1gprXlCoO8hbZminVQqHqhlia++uxwuYZfuyDNV rJbkiBDQSn0Kixhk4g44FlAM0AM2l1u5hb3vC2dTezYs/A9WQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704498495; x= 1704584895; bh=cDVUuadezugTmzmJuJs2t011iWS2CEM/ZvTkGtF9NmA=; b=t 8k7UzSutZylwnruirbgPcIbB1AJN98NiNE9E2+Slnm21cUiqBLMLb86d03ZlQ8fx 5EzBDh4Ahg9vQaTf6ih8jWi9aM4/UFUOqV6MW0Md6jzFyxXxl1E3K9j+awVprPnt h40bFX0g8vihqD1J08ucZX2h08mrW16neW/EiMm0nIvcEw42n2WeP0ZmPzDEBeEa V430BUe2rLXOeurDRwSdtOecNQ1AYo8N5F4wZZTEo0d8nd+I30WNDfDJIMs//qoh OH4C9Dv/1L3LF2dLkWBUJ5uBe7X+TVNd7B77WlbaNb/BW/V3pZZxonf/2V2zJQ3j iM3lgu5CUx0IKjOzECEUA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehtddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhushhpvggtthffohhmrghinhculdegledmnecujfgurhepofgfggfkjghffffhvffu tgfgsehtqhertderreejnecuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoe hlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhep ieekfeetgeelvdetledtkeefvedvteffvefffeehheeikeevkeeukefhuddviefhnecuff homhgrihhnpehphhhprdhnvghtpdefvheglhdrohhrghenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvg gthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2E9561700FD0; Fri, 5 Jan 2024 18:48:15 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1364-ga51d5fd3b7-fm-20231219.001-ga51d5fd3 MIME-Version: 1.0 Message-ID: <56eeb603-418c-4455-81c7-9bfbd160d6e2@app.fastmail.com> In-Reply-To: References: <4B81D2EE-0A84-4443-8F32-5D27AE43954C@gmail.com> Date: Fri, 05 Jan 2024 17:47:54 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: Fwd: [PHP-DEV] clarify the destructuring list() concept From: larry@garfieldtech.com ("Larry Garfield") On Fri, Jan 5, 2024, at 5:16 PM, M=C3=B6n=C3=B4me 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 =3D "a"; > $value =3D 1; > $array =3D [$key =3D> $value]; > > [$key =3D> $value] =3D $array; > > We all agree that now $key =3D 'a' and $value =3D 1 > > And I wonder why > What happens in this case : > > [$key =3D> $value] =3D ['b'=3D>2]; > > $key =3D 'b' and $value =3D 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 l= eft, 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