Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128963 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 130F81A00BC for ; Sat, 25 Oct 2025 11:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761390333; bh=appZK8CeYGUucIL+3p0H9acs9aYGq71asOCi/TSa7V8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=bl7zrb9GwfqQFMKgZNSRiZTg7/VRLdmgs6yWN5Q2szfFHvxsN5s3yiT1SZXDBD1G0 2S5M4tCCebEIz7PwBdJa6hf2yVHgi+C+IebnfwxE+JXJ4AVcwHdaN4vrDd+zq+YasC lNU5qz1emIKXbzmcL5cSQK89vLn6G4krfP9YhJxFXEBeGCOcgriSIG2R700grcr13/ mPwcQXMk5VujUB9korkEvj7/dvwg9hYgeC2lWHphVqSOAwUb6b/mU/AnOrhA7I20NY jh/kkcRL3FuM5nT2Ub3CUeI/cjpcxJSUpL/3JL0eL0sfLWvkjH2AajeWpjQVGeNMPm eWw62FxBaLZsw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 36DD518006E for ; Sat, 25 Oct 2025 11:05:31 +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.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from megan.smtp.mailx.hosts.net.nz (megan.smtp.mailx.hosts.net.nz [43.245.52.196]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) 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:05:29 +0000 (UTC) Received: from 122-57-27-239-adsl.sparkbb.co.nz ([122.57.27.239] helo=[192.168.1.67]) by megan.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1vCc5B-001a63-1Z for internals@lists.php.net; Sun, 26 Oct 2025 00:05:13 +1300 Message-ID: Date: Sun, 26 Oct 2025 00:05:00 +1300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC proposal for adding SORT_STRICT flag to array_unique() To: internals@lists.php.net References: <48b2d4f5-2baa-4dac-9f13-163ac68a4adf@app.fastmail.com> Content-Language: en-GB In-Reply-To: <48b2d4f5-2baa-4dac-9f13-163ac68a4adf@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Hosts-DKIM-Check: none From: Weedpacket@varteg.nz (Morgan) On 2025-10-25 21:23, Rob Landers wrote: > > Other than the bytes in memory and how they’re laid out, I fail to see > how 100 is different from 100. They’re conceptually identical, and > 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 different objects, array_unique() can't be used to deduplicate an array of objects - which I find myself wanting to do on a fairly regular basis. ``` $uniques = array_values(array_combine(array_map(spl_object_id(...), $source_array), $source_array)); ```