Here's a nice example inspired by Rob's comparison of object identity and
value:
https://gist.github.com/jmarble/c86b5b0b3373498c889bc9c5579105a8

On Sat, Oct 25, 2025 at 2:01 PM Jason Marble <
[email protected]> wrote:

> Rob has convinced me SORT_STRICT is semantically incorrect. I agree
> SORT_BINARY has merit, though I'm having difficulty with the implementation.
>
> I think I got too focused on _convention_ wanting to align naming
> convention with the existing SORT_* flags. But a perfectly acceptable
> alternative exists, ARRAY_UNIQUE_STRICT.
>
> I'm aware of the previous effort (https://externals.io/message/118952)
> made regarding the flag ARRAY_UNIQUE_IDENTICAL. While this is technically
> correct and follows existing convention (e.g. ARRAY_FILTER_USE_*), I
> personally feel it's a bit awkward.
>
> ARRAY_UNIQUE_STRICT is, I think, a bit more intuitive. Especially today,
> as `declare(strict_types=1)` has become more common and even encouraged,
> particularly for those who love PHPStan level max haha.
>
> Pull it, test it, break it. Let's do this!
>
> https://github.com/php/php-src/compare/master...jmarble:php-src:feature/array-unique-sort-strict
>
> On Sat, Oct 25, 2025 at 7:41 AM Morgan <[email protected]> wrote:
>
>> On 2025-10-26 00:16, Rob Landers wrote:
>>
>> >
>> > Object identity and value are different things...
>> https://3v4l.org/uZTsN
>> > <https://3v4l.org/uZTsN>
>> >
>>
>>
>>   $white == new Color("white")
>>
>> That's comparing the values of the objects' properties (which may or may
>> not be relevant to its "effective value" - the comparison applies to
>> private properties as well) and considering the aggregate to be the
>> "value of the object".
>>
>> Regardless, the comparison is certainly not useful to me (where
>> recursively grovelling around in the objects' properties would be
>> prohibitively expensive if not fatal), and doesn't make array_unique()
>> any more helpful in deduplicating.
>>
>

Reply via email to