Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128964 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 978111A00BC for ; Sat, 25 Oct 2025 11:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761391029; bh=vZ8n/JQR2T86XShUJUQCdw+SydScqrFfeVOa4WdG1Y0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=ftemw9AtSyyVvO5NY8A6bDtbifdKZmfB890+kmxctsimogBXS3YgRUf2SlWoo6vpF ZAKi+3NGcHn6Oc507mSgGwVDZFJ/U2z5GlBn0w1rpxH/t3J8RButtmf+rPwRJlUkLG iRaQWRiUohUF5aDcWiZeyfON8ZYb7WGGKNlyo1X7ZiQxSmbjg6sIA1ZPoklFY7NGu2 2EP4bLFTia5AwtRnHQGZzAmVF4fCtlh7WvNsO5Tp+YQ+elu/qOVwKaPFSGndpBFZfY n2L2iIn4uWd84OPOU59TtprYFtKQJ0RRXtvcwInsI4raFlTSmGMICpVVbmx87soaNq Ufe/FB7opIbpA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 370E2180056 for ; Sat, 25 Oct 2025 11:17:08 +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.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, 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 fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (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, 25 Oct 2025 11:17:07 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 10B5B1D00261 for ; Sat, 25 Oct 2025 07:17:02 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-05.internal (MEProxy); Sat, 25 Oct 2025 07:17:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=fm3; t=1761391021; x=1761477421; bh=vZ8n/JQR2T 86XShUJUQCdw+SydScqrFfeVOa4WdG1Y0=; b=qsA1a4U3k6t8IY6TOTaiJyHKvf IaFLUHxyILJQSM8TF35WSz7WgXmISXOUleYTo3ohn3gsnNmkDve0CHWS1YXQ9ir6 xNjf+EWp3RKBSJ6lMcNDfN9Oo3ZoF7vYk+BEyenmZWjz89XeR4lRngktKWR4JS1G SGj+ZPQM/AijLqm/onAa35X3KHMuK1pNMpHPU1M5sPjifkDIrj7Kmwfo1FdvbOBV rWFErPlStfIoM6+kG4+hLb/2YdlWGB6lWx8hXjIC/majrAKYWBQnGnRo8K/qVEdt +p51i+0b7TSRTT6v4yQT+1qYTarU1Q3DNbJcPEO2ASFVI9S4cnpC5uifHe+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm2; t= 1761391021; x=1761477421; bh=vZ8n/JQR2T86XShUJUQCdw+SydScqrFfeVO a4WdG1Y0=; b=q8ZZc1zlErngl8GZijJ+Trwh4+jd9WvQm5xXflc2EnuXTRtoNiL WzDmDpAUONp2DK6L1HXRJOOG36ooDz3kDcmHsgDX85wxJcfDvLalGUJkYVxodXAS MZoXgUAO0IP/FzGxKtT179b1ZsWvra+JKL2WRYJURhlWTHnHWvBf+KRPlaZf4YP0 AGIOV73elZc2fTNvqnYDdffL9Fgba6cMJhEC2yI7sky/F7y8qlRpTWLqeBgnZctv LKkiRdajpE2q1jwMMBDcPIw1Rzc5reeEbcf86CaiMPWhHZ7muzc58AXg0/+kBBTd TxiGGXlJ8FBgVv2up4yYVdeoNJybXBE1KAw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduhedvtdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmnecujf gurhepofggfffhvffkjghfufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgr nhguvghrshdfuceorhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvg hrnhepieelteejveetueeggeehtdfguddugfdttdekfeeuteduieehtdefvdejfeetleek necuffhomhgrihhnpeefvheglhdrohhrghdpphhhphdrnhgvthdpghhithhhuhgsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhho sgessghothhtlhgvugdrtghouggvshdpnhgspghrtghpthhtohepuddpmhhouggvpehsmh htphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgv th X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 6F4831820054; Sat, 25 Oct 2025 07:17:01 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AiBMg20Z7Ek3 Date: Sat, 25 Oct 2025 13:16:40 +0200 To: internals@lists.php.net Message-ID: In-Reply-To: References: <48b2d4f5-2baa-4dac-9f13-163ac68a4adf@app.fastmail.com> Subject: Re: [PHP-DEV] RFC proposal for adding SORT_STRICT flag to array_unique() Content-Type: multipart/alternative; boundary=bb75b1b2e3934dc5ba5b7855ddcd9997 From: rob@bottled.codes ("Rob Landers") --bb75b1b2e3934dc5ba5b7855ddcd9997 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sat, Oct 25, 2025, at 13:05, Morgan wrote: > On 2025-10-25 21:23, Rob Landers wrote: > >=20 > > Other than the bytes in memory and how they=E2=80=99re laid out, I f= ail to see=20 > > how 100 is different from 100. They=E2=80=99re conceptually identica= l, and=20 > > array_* functions generally behave by **value**, not by **identity**. > > >=20 > In the case of objects, "value" and "identity" are the same thing;=20 > without a __toString() method that always produces different strings f= or=20 > different objects, array_unique() can't be used to deduplicate an arra= y=20 > of objects - which I find myself wanting to do on a fairly regular bas= is. >=20 > ``` > $uniques =3D array_values(array_combine(array_map(spl_object_id(...),=20 > $source_array), $source_array)); > ``` >=20 Object identity and value are different things... https://3v4l.org/uZTsN That=E2=80=99s literally the entire point of my original Records RFC: ht= tps://wiki.php.net/rfc/records =E2=80=94 and a userland implementation h= ere: https://github.com/withinboredom/records along with a few nice-to-h= aves https://github.com/withinboredom/common-records =E2=80=94 Rob --bb75b1b2e3934dc5ba5b7855ddcd9997 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sat, Oct = 25, 2025, at 13:05, Morgan wrote:
On 2025-10-25 21:23, Rob Landers wrote:
>= ; 
> Other than the bytes in memory and how they=E2=80= =99re laid out, I fail to see 
> how 100 is different = from 100. They=E2=80=99re conceptually identical, and 
&g= t; array_* functions generally behave by **value**, not by **identity**.=
>

In the case of objects, "value"= and "identity" are the same thing; 
without a __toString= () method that always produces different strings for 
dif= ferent objects, array_unique() can't be used to deduplicate an array&nbs= p;
of objects - which I find myself wanting to do on a fairly = regular basis.

```
$uniques =3D array= _values(array_combine(array_map(spl_object_id(...), 
$sou= rce_array), $source_array));
```


Object identity and value are different things..= . https://3v4l.org/uZTsN

That=E2=80=99s literally the entire point of my or= iginal Records RFC: ht= tps://wiki.php.net/rfc/records =E2=80=94 and a userland impleme= ntation here: = https://github.com/withinboredom/records along with a few nice-= to-haves https://github.com/withinboredom/common-records

=
=E2=80=94 Rob
--bb75b1b2e3934dc5ba5b7855ddcd9997--