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

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

That’s literally the entire point of my original Records RFC: 
https://wiki.php.net/rfc/records — and a userland implementation here: 
https://github.com/withinboredom/records along with a few nice-to-haves 
https://github.com/withinboredom/common-records

— Rob

Reply via email to