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));
```

Reply via email to