My array:
$arr = [['abc', 'a'],['xyz', 'f'],['abc', 'x']];
I need to remove any duplicate first values, e.g. there are two abc values above, array_unique will not work as the second value is different:
$arr = array_unique($arr, SORT_REGULAR);
Is there a way to get only unique values based on the first value. I cannot change the structure above.
Required Result:
$arr = [['abc', 'a'],['xyz', 'f']];
source
share