Hello,
I would like to propose addition of a third (optional) argument for array_unique which will be callback for comparing elements.
There's a plenty of usecases for this. For example, what I've been dealing with can be described like so:
<?php
$obj1 = new EntityName("asd");
$obj2 = new EntityName("qwe");
$a = [new EntityWrapper($obj1, ...), new EntityWrapper($obj2, ...), new EntityWrapper($obj1, ...)];
// now it can be solved like so:
$newArray = [];
foreach ($a as $e) {
});
Actually my problem was a little different but you get the idea... And I think there will be even more usecases for this.
Here's a patch for master branch with implementation of this proposal: https://gist.github.com/nikita2206/7354392