What would be the best way to ignore the duplicates for customer_name in this grouped array? I only want to display a list of unique names.
Array
(
[1] => Array
(
[0] => Array
(
[model_id] => 1
[work_order] => 10999
[id] => 1
[model_name] => STC1.5
[stock] => 3
[free] => 1
[customer_name] => Jane Doe
)
[1] => Array
(
[model_id] => 1
[work_order] => 10998
[id] => 1
[model_name] => STC1.5
[stock] => 3
[free] => 1
[customer_name] => Jane Doe
)
)
)
array_unique($array, SORT_REGULAR);
– Always Sunny Jul 30 '18 at 16:1610998
or10999
? – MonkeyZeus Jul 30 '18 at 16:20customer_name
s without duplicates or you need to remove some entries of the array to avoid having two entries with the samecustomer_name
? If the latter case is the correct one then you should define the rules of ignoring the duplicates (apart from them having the samecustomer_name
). What entry to keep when a duplicate is detected? The first one? The last one? The one that have the smallest/biggest value inid
? etc. – axiac Jul 30 '18 at 16:22