Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128697 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 1381A1A00BC for ; Sat, 13 Sep 2025 10:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1757758812; bh=4VTIrTV+NdoQ5vhzPE3BMezvh42XVWRCb/UU3hT1w+M=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=Hdf8147tv/XaQtOYVHpAzXLlPmA6fM1E1/akIzJX1U3ii5C8dyhIryfZgLEPG4lSU IsCZyJ9+kchbAi4HPoo9a634s7s8P7LfUa8JiVPT6eODBB4xotWsao6xdrvCKZvmaM hdBBDd1EoHV8O/HBffUpA/w/3CX3PJTRnDRr5bn/73Gn/VPCsc7THZsQBXlvxYwJyy 5TyaPSQ6B9EEa00Rl6VCrvhsMRg2T9tDpGwwpWB4C2ZZ8xuEWR3fV/K5wYDDvUxDpY jrtWC9SUzFkII+BlAqF2AOq97m9sWVqG/pFv7ZxYvrTG57Muv29jXy3e++oRShrQ2n OfhWeutfiuAaw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F68018006E for ; Sat, 13 Sep 2025 10:20:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (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 ; Sat, 13 Sep 2025 10:20:11 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3B8401400113; Sat, 13 Sep 2025 06:21:37 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sat, 13 Sep 2025 06:21:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :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=fm1; t=1757758897; x=1757845297; bh=4VTIrTV+NdoQ5vhzPE3BMezvh42XVWRCb/UU3hT1w+M=; b= MxxH4BKRdf38XRgC/wT1TTWV3Kp/2rgQh95t807s1Q5wVvXC2fIUakgdwbXV74uF dm9hoRKfxwGWRL/jgOMYXXhDmy/66oHd/qFQpMfFO8pXbbdXSAdkUjGRJJrsc321 UFrb2Ta4H5MtVHm9tnbMf+TcqoSjquO3r7IKwV5GwV2wjiD2wVPGWiYUyTDyJPpv v7IWJpPhSv24jqfl5yvah/SzDimXAT2UQmE8vAxLp4jLiaF6ap73BGvEvKbJHLvV tzwtSOAcGzjO3qhaFZxRe303y9Y/7dEwnIqKfjDkaLfVaC2+vCzIG10/VgFeJgqJ iiLT51DJamr9NAZAeXFAcQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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-sender:x-me-sender:x-sasl-enc; s=fm1; t=1757758897; x= 1757845297; bh=4VTIrTV+NdoQ5vhzPE3BMezvh42XVWRCb/UU3hT1w+M=; b=f Vj+TjihEb5PdgefTtjHtgssR8cjKAbAs8EL8fzC+Z94UpNv9v8T6khM4bDEkFMhz 7gxh9Gg8GDRnTZe5+H2h3Yh6dk+haMjIGjo63AedvRRoThJADobVrHrN14Sp85UM n4S4QbPoPUwn7lNRVGdv3EuiCFqndH48EItSNCZCJ/1CxBC0ub/5BQ5cs12TBXH6 oJFU4fnhLD4Srrez4H0wJhB76oPp+fh/YmRRfpbdPdx6xWE/iSe5BqWRk001YM6P 56pKZT8mNfZ2/DEMXNwBcsc/xPWT7/c1JRzhM2KDdrWqcKCmVmpPxsW1DV+zkwiv UxA/EfNkfLDuiSawjTBvA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdefudeijecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomhepfdftohifrghn ucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtg hordhukheqnecuggftrfgrthhtvghrnhepuefgjeefgffhvdduvdeijefhfeefleeujeei hefftdegtddvteduudefudekueeunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhnsggp rhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnh grlhhssehlihhsthhsrdhphhhprdhnvghtpdhrtghpthhtohepkhhguhgvshhtsehphhhp rdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 13 Sep 2025 06:21:36 -0400 (EDT) Date: Sat, 13 Sep 2025 11:21:35 +0100 To: internals@lists.php.net CC: Ken Guest Subject: Re: [PHP-DEV] [RFC proposal] Syntactic sugar for array push() User-Agent: K-9 Mail for Android In-Reply-To: References: <23fc3c05-f238-44d5-9a27-778c73db4a23@app.fastmail.com> Message-ID: Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 12 September 2025 20:02:04 BST, "Du=C5=A1an Krehe=C4=BE" wrote: >[+] array_push >[-] array_pop >[-<] array_shift > >array_unshift() is a special case of array_merge(), so it would then need >syntactic sugar for merging arrays, or rather a reserved merge=2E array_unshift is no more a special case of array_merge than array_push, pa= rticularly in the single-element case we're talking about here - it's reall= y just the same operation at the other end of the array=2E=20 Since we have an extremely well-established array_push shorthand, so don't= need a new one, we could perhaps have "<" for "at start", and "-" for "pop= ": $foo[] =3D $toPush; $popped =3D $foo[-]; $foo[<] =3D $toUnshift; $shifted =3D $foo[-<]; I'm not totally convinced it's necessary, but I don't completely hate it= =2E P=2ES=2E Quick reminder to all contributors on this thread that the policy= here is to reply *below* the relevant quoted text, editing as necessary; d= o not reply *above* the entire quoted thread=2E Rowan Tommins [IMSoP]