How to remove duplicate values from a multidimensional array.
For example, I have an array:
Array
(
[0] => Array
(
[fruit_id] => cea2fc4b4058
[title] => Apple title one
[name] => Apple
[weight] => 22
)
[1] => Array
(
[fruit_id] => sdfsdec4b4058
[title] => Grapefruit title one
[name] => Grapefruit
[weight] => 19
)
[2] => Array
(
[fruit_id] => hjkvcbc4b4058
[title] => Grapefruit title two
[name] => Grapefruit
[weight] => 17
)
[3] => Array
(
[fruit_id] => tyuutcgbfg058
[title] => Lemon title one
[name] => Lemon
[weight] => 15
)
[4] => Array
(
[fruit_id] => lkjyurtws4058
[title] => Mango title
[name] => Mango
[weight] => 13
)
[5] => Array
(
[fruit_id] => bner3223df058
[title] => Lemon title two
[name] => Lemon
[weight] => 11
)
)
In this array, I need to leave only one fruit with the maximum weight. I want to save all the data, but at the same time remove duplicate fruits. Thank.