For instance
[
['foo' => 1, 'bar' => 2],
['foo' => 1, 'bar' => 3],
['foo' => 2, 'bar' => 4]
]
I'd like to become
[
['foo' => 1, 'bar' => 2],
['foo' => 2, 'bar' => 4]
]
Based on the duplicate value for foo
. I'm not bothered which of the entries goes, either is fine.
I can write something to loop over the array and perform this check myself, but I wondered if there's a built-in function (or combination of a couple of them) that can achieve this result?